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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Variable substitution
by roboticus (Chancellor) on Oct 21, 2009 at 05:06 UTC | |
by jakobi (Pilgrim) on Oct 21, 2009 at 10:00 UTC |