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 "http://www.cgiscript.ne +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 "http://www.cgiscript.net/ +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 \"http://www.cgiscript.net +/encrypt_index.htm\"; print uri_unescape $t;"
    It is untested, I did not use windows.
    Boris
      So you must escape all quotes inside your script.
      Nah, you'd just use single quotes inside your script.

      Abigail

      Windows supports double AND single quotes.
      perl -MURI::Escape -MLWP::Simple -e"$t =get 'http://www.cgiscript.net/ +encrypt_index.htm\'; print uri_unescape $t;"
      Anne
        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.
        Boris
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)