in reply to Re: passing refs to subs
in thread passing refs to subs
Actually, it's not quit that simple. Perl's standard calling convention isn't pass by value. The values that you get in @_ are aliases to the original variables, so changing @_ will change the values outside the subroutine, as this simple test demonstrates.
--my $x = 1; mult($x); print "$x\n"; sub mult { $_[0] *= 10; }
"Perl makes the fun jobs fun
and the boring jobs bearable" - me
|
|---|