in reply to Re: Multiple Levels of Array Dereferencing Have me Stumped
in thread Multiple Levels of Array Dereferencing Have me Stumped
Just about nothing. There is no reason that I can see to prefer:
oversub foo { my @foo = @{[@{$_[0]}]}; # etc }
In fact try this:sub foo { my @foo = @{$_[0]}; # etc }
See? You get a private copy already.my $bar = ["hello", "world"]; foo($bar); print "$bar->[0]\n"; sub foo { # Make my copy. my @foo = @{$_[0]}; # Try to mess up the first element. $foo[0] =~ s/h/H/; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE (tilly) 2: Multiple Levels of Array Dereferencing Have me Stumped
by cianoz (Friar) on Nov 05, 2000 at 23:28 UTC | |
by tilly (Archbishop) on Nov 05, 2000 at 23:34 UTC |