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)