Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Count of element in array - autovivification

by 1nickt (Canon)
on Feb 22, 2021 at 00:21 UTC ( [id://11128639]=note: print w/replies, xml ) Need Help??


in reply to Count of element in array - Help

Hi,

This line:

$MMANS=$arr[($ANS-1)][3];
is populating the array with a new element $arr[($ANS-1)] if it doesn't exist. See autovivification.

I would suggest validating your input and disallowing a value greater than the number of elements in your array.

Hope this helps!


The way forward always starts with a minimal test.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11128639]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-25 06:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found