![]() |
|
Keep It Simple, Stupid | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
return doesn't change @_.
@_ is an array of aliases to the actual arguments, so changing @_ changes the actual arguments.
In your case, it's bit more complex. Changing the function to wouldn't have helped, as you're working with an array of arrays. The inner arrays are represented as references, so even if you store the references in a different @arr, they still refer to the same inner arrays. To keep the array unchanged, only assign to the copy, don't change the references from the original array.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
In reply to Re: Array value changing for some reason
by choroba
|
|