my ($Results1, $Results2); &DoList($List, $Results1, $Results2, $tmp, $var);
If you want the subroutine to modify its parameters, you have to modify elements of @_ directly, not taking a copy:
sub DoList { my $List = $_[0]; # first element in @_ my ($tmp, $var) = @_[3,4]; $_[1] = `$List $tmp`; $_[2] = `$List $var`; }
See perlsub, in the DESCRIPTION section just after the first code examples: "... a function is free to do in-place modifications of @_ and change its caller's values".
--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: Subroutine return value
by shmem
in thread Subroutine return value
by monk2b
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |