At 08.26 -0500 1999.02.04, Emmanuel. M. Decarie wrote: >myFunc(\@global); > >or > >@global = myFunc(\@global); The problem is that the latter is slower. Readability is good, but if @global is sufficiently large, it can be quite slow. Frankly, though, I have no problem with the first one insofar as readability goes. I would look at the latter and say "why?". >My understanding at the moment is that when you pass by reference an array >or a >>>>>>>hash, there is nothing to show in the params that the >function have the >>>>>>>right to make changes to the original. Sure. It is implicitly understood. If you don't want changes made to your data, then don't pass a reference, or pass a copy of the data. @newdata = myFunc([@global]); That creates a reference to a copy of the data. Of course, if @global contains references as elements, those passed to myFunc still refer to the original data. You can also do something like: use Data::Dumper; @newdata = myFunc(eval Dump \@global); Which will totally unpack @global into a string, which when passed to eval will result in a reference to a data structure identical to [@global], but without any common references. You could also do that in your subroutine: use Data::Dumper; @newdata = myFunc(\@global); sub myFunc { my $newdata = eval Dump shift; } -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch