in reply to Problem w/ single-quoted strings
Variables and some escaped characters are not interpolated when between single quotes. The newline character referred to in your quote is the real character, not the \n representation. To get a new line, your test code would have to be doing something like this:
Double quotes will allow escaped characters and variables to be interpolated. You can also use qq{}.
Update: added some extra detail
Concerning your code sample, the first line prints the word 'Testing' followed by the characters '\' and 'n'. The second line prints the word 'Testing' followed by a backslash, created by escaping a backslash (\\), followed by 'n'. The third line prints the word 'Testing' followed by a backslash created by escaping a backslash, followed by the characters '\' and 'n'.print 'Testing ';
Double quotes will allow escaped characters and variables to be interpolated. You can also use qq{}.
Update: added some extra detail
bassplayer
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Problem w/ single-quoted strings
by eweibust (Initiate) on May 13, 2004 at 19:56 UTC | |
by bassplayer (Monsignor) on May 14, 2004 at 05:36 UTC |
In Section
Seekers of Perl Wisdom