Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: How do I print a quote with a perl one liner on dos?

by larryk (Friar)
on Mar 23, 2005 at 11:21 UTC ( #441740=note: print w/replies, xml ) Need Help??


in reply to Re^2: How do I print a quote with a perl one liner on dos?
in thread How do I print a quote with a perl one liner on dos?

when you print $whatever you don't need to print "$whatever" unless you want to print "$whatever and $something else in the same string" - that'll at least save you two backslashed double quotes.

that said, the point is that with the windows command shell the double quote is the string quoting character so in order not to have your perl -e code string stop at the next ", you have to escape it for the shell's benefit. to illustrate - escaping outside of the -e code: perl -e "print qq(@ARGV)" \"hello world\"

I guess the trick is that you use single quotes instead ;)

perl -e "$helloworld = qq('hello world'); print $helloworld"

   larryk                                          
perl -le "s,,reverse killer,e,y,rifle,lycra,,print"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://441740]
help
Chatterbox?
[1nickt]: TCLion are you parsing the dates with DateTime or another tool?
[1nickt]: I note DateTime::Format:: Flexible, announced immediately below this box in the CPAN feed
[Corion]: 1nickt: That one sounds sensible as it will tell you when it found an error
[1nickt]: Throws on error, I believe
[1nickt]: But should handle month as number or word

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (19)
As of 2017-03-23 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (287 votes). Check out past polls.