in reply to Re: Problem w/ single-quoted strings in thread Problem w/ single-quoted strings
First off, using the \n was wrong on my part. I'm not concerned about newlines. The key to my post was the behavior I'm seeing when using backslashes inside single-quoted strings. Please look back at the quote I pulled from the book. It is my cause of concern. It said that to get a backslash to print as part of a single-quoted string you need to use two and what I showed proved that to be false. So I'm not sure if I'm misreading what the author was saying. If you have "Learning Perl" I'm quoting the 3rd edition, page 23.
Re: Re: Re: Problem w/ single-quoted strings
by bassplayer (Monsignor) on May 14, 2004 at 05:36 UTC
|
It said that to get a backslash to print as part of a single-quoted string you need to use two and what I showed proved that to be false.
I don't believe that you have proven the statement false. When you used two, it interpolated it as one (as your quote described) and it came out as \n. Basically, it only interpolates \' and //, so \n is not going to become a newline. I apologize for any lack of clarity. nmcfarl provides a nice example below, and Stevie-O's #4 (below) lays it out nicely.
| [reply] [d/l] [select] |
|