"be consistent" | |
PerlMonks |
Array mysteriously growingby AntsPants (Novice) |
on Mar 09, 2006 at 15:01 UTC ( [id://535403]=perlquestion: print w/replies, xml ) | Need Help?? |
AntsPants has asked for the wisdom of the Perl Monks concerning the following question:
I have a list, and sometimes I want to read-ahead (next element) in the list and compare it to my current element (while the index stays on my current element)
If there's a next element (i.e. I'm not out of bounds) then I'll grab a value. If there's no next element then I'm done. This works .......... but then I thought I'd try ............ and that added .......... which meant my list had grown. The next time round, it added ...... next time round .............. usw. The same happens if I use ............ Now, it seems as though $ordered_list->[($i+1)]->[0] is evalutaing to true even though it's out-of-bounds but what strange behaviour!! Can someone throw some light on that for me? This isn't critical as I'm using ... which my prefered way .... I'm just interested in the internals with this prob. Cheers -Ants
Back to
Seekers of Perl Wisdom
|
|