Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

RE: String Literals in Perl

by tye (Cardinal)
on Aug 02, 2000 at 19:50 UTC ( #25754=note: print w/ replies, xml ) Need Help??


in reply to String Literals in Perl

A fine node with one mistake:

print 'blah\\blah',"\n";

prints "blah\blah". To put a literal \ in a Perl single-quoted string, you should use \\, just like with double-quoted strings. If the character after a \ (in a single-quoted string) doesn't happen to be ' or \, then the \ is preserved. But using this fact often leads to confusion like the mistake in your post, so I discourage people from doing that.

I really wish Perl had used '' (two adjacents 's) to quote ' inside of 's. But my time machine is broken.


Comment on RE: String Literals in Perl
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-07-13 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (248 votes), past polls