in reply to Is it possible to do pass by reference in Perl?
Try it:
And foo @x does what you'd expect given the aliasing.sub foo { $_[0] = 17 } my $x=0; foo $x; print "$x\n"
Of course, the usual course of action is to copy them into my variables. Which is why it's perceived as call by value.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Passing a reference by value is somewhat equivalent to call by reference
by stefp (Vicar) on Sep 24, 2001 at 15:55 UTC |