Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

"bareword found near www" in oneliner

by coldfingertips (Pilgrim)
on Feb 08, 2004 at 21:26 UTC ( #327502=perlquestion: print w/replies, xml ) Need Help??

coldfingertips has asked for the wisdom of the Perl Monks concerning the following question:

Someone gave me this snippet below but I can't get it to run in my CMD prompt. I am running on WinXP if that makes any different. It says "bareword found near www". Can someone see an error in this?
perl -MURI::Escape -MLWP::Simple -e "$t = get " +t/encrypt_index.htm"; print uri_unescape $t;"
Update: This one says it cannot find a string terminator:
perl -MURI::Escape -MLWP::Simple -e'$t =get " +encrypt_index.htm"; print uri_unescape $t;'

20040209 Edit by Corion: Retitled from "URI::Escape"

Replies are listed 'Best First'.
Re: "bareword found near www" in oneliner
by borisz (Canon) on Feb 08, 2004 at 22:04 UTC
    windows support only double quotes. So you must escape all quotes inside your script.
    perl -MURI::Escape -MLWP::Simple -e"$t =get \" +/encrypt_index.htm\"; print uri_unescape $t;"
    It is untested, I did not use windows.
      Windows supports double AND single quotes.
      perl -MURI::Escape -MLWP::Simple -e"$t =get ' +encrypt_index.htm\'; print uri_unescape $t;"
        Sure, windows supports qouble and single quotes inside a perl script. But I was talking about quoting mechanisms of your shell ( cmd.exe ). Sorry if this was not obvious.
      So you must escape all quotes inside your script.
      Nah, you'd just use single quotes inside your script.


Re: "bareword found near www" in oneliner
by edan (Curate) on Feb 09, 2004 at 11:29 UTC

    Another handy way to avoid quoting problems inside your perl one-liners is to use the generalized quoting constructs such as q() and qq(). See perlop under 'Quote and Quote-like operators' for the full scoop.

    edan (formerly known as 3dan)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://327502]
Approved by rozallin
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2022-06-25 05:29 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (81 votes). Check out past polls.