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}
In reply to Re: Passing values along with the called script
by shmem
in thread Passing values along with the called script
by Kashratul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |