You got bitten by autovivification!
You need to check if $ANS is in range before accessing the lower array.
See also Explaining Autovivication
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re: Count of element in array - Help
by LanX
in thread Count of element in array - Help
by g_speran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |