Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Counting elements in array

by thezip (Vicar)
on Jan 29, 2014 at 19:35 UTC ( [id://1072569]=note: print w/replies, xml ) Need Help??


in reply to Counting elements in array

You have (at least) a couple of options:

print "Array size is ", scalar(@array), "\n";
- or -
printf "Array size is %d\n", scalar @array;

Your pick. You need to force scalar context, which I explicitly did by using the scalar function.


*My* tenacity goes to eleven...

Log In?
Username:
Password:

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

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

    No recent polls found