Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Problem w/ single-quoted strings

by eweibust (Initiate)
on May 13, 2004 at 19:56 UTC ( [id://353195]=note: print w/replies, xml ) Need Help??


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.
  • Comment on Re: Re: Problem w/ single-quoted strings

Replies are listed 'Best First'.
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.

    bassplayer

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://353195]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-20 04:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found