We are at the Perl Conference in San Diego having lots of fun and
learning lots of cool new stuff. Be sure to follow the coverage at
http://use.perl.org/ and http://www.perl.com/ :-)
On to the tip: Anyone have seen code like
print "$site (\"$title\")";
Now, it is quite annoying to read all those \'s, so you would think
there is a better way.
Well, there is! :-)
The above line could be written as
print qq[$site ("$title")];
So instead of using " as the quote operator we used qq[ and ] to end
the quote.
You can also use for example qq{ (or any other form of "brackets"), like
print qq{...};
Like "text" can be substituted with qq[text] you can use a single q
for ', so a confusing statement like
'\'daily-tips-subscribe@perl.org\''
can be written as
q['daily-tips-subscribe@perl.org']
instead.
For more information, run "perldoc perlop" and search for "Quote and
Quote-like Operators".
To unsubscribe: mail daily-tips-unsubscribe@perl.org
To subscribe: mail daily-tips-subscribe@perl.org
Or visit: http://learn.perl.org/tips/
Comments, suggestions? Send them to ask@perl.org.