|There's more than one way to do things|
Re: Changing an array from a subby NetWallah (Canon)
|on Feb 13, 2018 at 06:52 UTC||Need Help??|
Your call to
Passes the elements of @A into the subroutines @_.
Your implementation of "sub ChangeArray6" updates the contents of @_ which were previously aliased to the contents of @A.
Note: Only the contents of @_ were changed. The contents of @A were not.
Here are two alternative ways to update the contents of @A:
In the sample above, the change made to @_ is RETURNED, then ASSIGNED to @a, changing @a.
In the second piece of code, we pass a REFERENCE to @a. The subroutine assigns new content to the thing(array ref-de-referenced) that it's first parameter referenced (@a).
See 'perldoc perlref'.
Python is a racist language what with it's dependence on white space!