Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Count elements in multidimensional arrays

by BillKSmith (Monsignor)
on May 25, 2019 at 12:23 UTC ( [id://11100511]=note: print w/replies, xml ) Need Help??


in reply to Count elements in multidimensional arrays

Paladin has already shown that you could have found your error yourself if you had used the pragmas "strict" and "warnings". Also note that a little extra whitespace to align your array definition can make it easier to read. That alone can help to avoid errors in accessing them.
use strict; use warnings; my @ar1 = ( ["one", "two", ], ["three", "four", "five", ], ); my $count = scalar @{ $ar1[1] }; print "count = $count\n";
Bill

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-05-19 23:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found