in reply to Passing values along with the called script
Say you have 2 values in the variables $foo and $bar. To run x.pl in another process:
$foo = 'whatever'; $bar = '42'; system $^X, 'x.pl', $foo, $bar; # run a new "perl script args"
to call x.pl from within the same perl interpreter:
$foo = 'whatever'; $bar = '42'; { local @ARGV = ($foo, $bar); do 'x.pl' };
In both variants $foo and $bar are in @ARGV in x.pl.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing values along with the called script
by Kashratul (Acolyte) on May 13, 2008 at 04:12 UTC | |
|
Re^2: Passing values along with the called script
by Kashratul (Acolyte) on May 13, 2008 at 08:44 UTC |