in reply to Re^2: Pass array, then clear
in thread Pass array, then clear
I did not suspect that the subroutine made a copy of the memory address
It doesn't. You do, with the my($data) = @_; snippet. If you directly manipulate the argument, it works as you expect:
sub clear_it { $_[0] = []; }
Because you're then working on the original reference, not on the copy you made.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Pass array, then clear
by Anonymous Monk on Jan 16, 2018 at 18:37 UTC | |
Re^4: Pass array, then clear
by Anonymous Monk on Jan 16, 2018 at 20:36 UTC |
In Section
Seekers of Perl Wisdom