Don't ask to ask, just ask | |
PerlMonks |
Re: $#{$array_ref} changes in loopby Sidhekin (Priest) |
on Apr 18, 2007 at 03:04 UTC ( [id://610689]=note: print w/replies, xml ) | Need Help?? |
You are bitten by autovivification:
If $i at this time points beyond the end of the array, an arrayref will spring into existence, as you dereference the hitherto unexisting element. Solution: Don't do that. A common strategy is to protect the dereferencing:
Depending on the rest of your outer loop, other solutions may be cleaner though.
print "Just another Perl ${\(trickster and hacker)},"
In Section
Seekers of Perl Wisdom
|
|