in reply to Re^6: perlsub question..
in thread perlsub question..
Your statement :
@bar expands to a list of its elements, with anonymous undefined values in place of nonexistent elements
is negated by the code I posted. If "nonexistent elements" were indeed passed, assigning values to the corresponding aliases would vivify, in the original array. This is not the case.
The only elements that can get persistent new values from inside the sub are "existing" elements, or explicitly passed elements, as Jenda indicated.
I agree that it would be crufty to take advantage of this in production code. I also think this behaviour is "correct", and sufficiently documented for most code, and can be persuaded that since the behaviour is subject to change, it should not be encouraged/documented. I'm just trying to understand what the behaviour is, and trying to ensure that I have not mis-understood it.
"An undefined problem has an infinite number of solutions." - Robert A. Humphrey "If you're not part of the solution, you're part of the precipitate." - Henry J. Tillman
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: perlsub question..
by ysth (Canon) on Jun 24, 2007 at 21:49 UTC | |
|
Re^8: perlsub question..
by shmem (Chancellor) on Jun 24, 2007 at 21:59 UTC | |
by ysth (Canon) on Jun 24, 2007 at 22:53 UTC | |
by shmem (Chancellor) on Jun 25, 2007 at 07:00 UTC |