[Edinburgh-pm] perl one-liner problem

Miles Gould miles at assyrian.org.uk
Sat Jul 19 15:54:58 PDT 2008


On Sat, Jul 19, 2008 at 04:07:41PM -0300, Adriano Ferreira wrote:
> It seems like you need '--' to stop perl for interpreting the
> command-line arguments:
> 
> perl -s -e "print $oldage;" -- -oldage=abc

Or rather,

perl -s -e 'print $oldage;' -- -oldage=abc

or else your script will suffer variable interpolation by the shell, and
your '$oldage' will be replaced by the nonexistent shell variable
$oldage, leaving perl to execute the script

print ;

which probably isn't what you wanted :-)

HTH,
Miles

-- 
Time is an illusion; lunchtime doubly so.
  -- Ford Prefect


More information about the Edinburgh-pm mailing list