perldoc -f defined tells us:
Use of "defined" on aggregates (hashes and arrays) is deprecated. It used to report whether memory for that aggregate has ever been allocated. This behavior may disappear in future versions of Perl.
So that's a bad thing and you shouldn't do that.
But you're not using defined on an array, you're using defined on an array slice. perldoc -f defined is silent on what this does, so the behaviour is undefined. Which means that it's quite possible for it to change between versions of Perl or different architectures.
As others have pointed out, it's difficult to really know what you are trying to do there. Once you've worked it out, we can help you to reimplement it in "real" Perl.
--"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: defined array question
by davorg
in thread defined array question
by toadi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |