in reply to Re: Pass by Value does not work
in thread Pass by Value does not work

Not to sound too dense, but doesn't Perl always use "pass by reference," in that changing anything in the $@ array will change its values in the calling routine?

Of course, the language I grew up using always passes by reference, so it usually takes a mental effort to assume any changes in a sub to passed variables don't propagate upstream.


Information about American English usage here and here. Floating point issues? Please read this before posting. — emc

Replies are listed 'Best First'.
Re^3: Pass by Value does not work
by almut (Canon) on Feb 21, 2009 at 13:03 UTC

    I suppose the OP was thinking that - due to the @ali = @_ - the entire data structure would be copied...  And the "pass by value" was probably referring to left_triangle(@xx) vs. left_triangle(\@xx) — with the "values" being the array refs.   (Only the OP can tell for sure, though, what his/her expectation had been.)

      Your supposition makes perfect sense to me, and it was something I didn't even think of.


      Information about American English usage here and here. Floating point issues? Please read this before posting. — emc