Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
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 cooling their heels in the Monastery: (4)
As of 2025-06-14 23:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.