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

Re: Variable substitution

by jakobi (Pilgrim)
on Oct 20, 2009 at 21:26 UTC ( [id://802324]=note: print w/replies, xml ) Need Help??


in reply to Variable substitution

If you're indeed using `perl -e ...` from inside perl, you need to add an extra layer of backslashes, as you're forgetting to protect against the extra interpolation due to the shell: you're running perl, invoking the shell (``) which in turn invokes perl. And your variables, esp. $_ hopefully is something very simple that parses as a single shell word.

(In case you're invoking `perl` from a shell script, just export $file, and you can then access the variable's content in Perl using $ENV{file})

Either way, do consider using single quotes instead of your double quote: `perl -e '...'`, which allows you to get rid of some backslashes...

HTH
Peter

Replies are listed 'Best First'.
Re^2: Variable substitution
by roboticus (Chancellor) on Oct 21, 2009 at 05:06 UTC

      But your regex contains .* and this results in just the four letter word RTFM, which I hate with a passion in its standalone version.

      Shouldn't we all remember that RTFM is a protocol prefix and requires an obligatorie MEME URI which provides at least an additional hint or keyword?

      So the proper use should be a still sufficiently terse RTFM://<check_both_quoting_and_consider_rethinking_your_approach>.

      ;>
      Peter (who is a bit ashamed to have failed roboticus' elegance & brevity test)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2024-04-25 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found