in reply to Count of element in array - Help

$MMANS=$arr[($ANS-1)][3];

You got bitten by autovivification!

You need to check if $ANS is in range before accessing the lower array.

update

See also Explaining Autovivication

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery