The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

paullau3 (1) [Avatar] Offline
#1
Hi all,
I am somewhat of a newbie, and was running this script, and was curious why it doesn't work as I think it would:
PS C:paullO2Project> $test = "a c d e tg d f s".Split()
PS C:paullO2Project> $test[0]
a
PS C:paullO2Project> "$test[0] hello $test[1]"
a c d e tg d f s[0] hello a c d e tg d f s[1]

Originally I wanted to use the tab escape sequence(`t)to append the first element and the second element(not hello). Why is it printing out all the characters?

I know how to get around it:
$test[0] + "hello" + $test[1] , but I was wondering why the other one doesn't work.

Thanks,
Paul