No such thing as a small change | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hello citi2015, I meant Perl’s design decision to remove the aliasing when @_ is assigned-to within a subroutine. You can, of course, do the swap by explicitly accessing the subroutine arguments as individual elements of @_:
— but note the necessity of “remembering” the initial value of $_[0] by storing it in a temporary variable. And I think that answers my question: if the aliasing were not removed, @_ = reverse @_ would produce wrong results, because some elements would be changed (assigned-to) before they were assigned-from. Hope that helps,
In reply to Re^3: Accessing Arguments inside Subroutines via @_
by Athanasius
|
|