Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re^5: Array value changing for some reasonby poj (Abbot) |
on Jan 01, 2019 at 16:34 UTC ( [id://1227881]=note: print w/replies, xml ) | Need Help?? |
$arr[$i] = [reverse @{$arr[$i]}];
assigns a new reference (by creating a new anonymous array) to $arr[$i] replacing the reference copied from @_. Without that reference you can't change the contents of @_ Whereas @{$arr[$i]} = reverse @{$arr[$i]} uses the reference copied from @_ to change the existing array elements. # $#_[$i] doesn't work or poj
In Section
Seekers of Perl Wisdom
|
|