Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Array value changing for some reasonby choroba (Cardinal) |
on Dec 31, 2018 at 22:42 UTC ( [id://1227849]=note: 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 Section
Seekers of Perl Wisdom
|
|