Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Number of elements in array

by blue_cowdawg (Monsignor)
on Sep 24, 2012 at 13:57 UTC ( #995390=note: print w/replies, xml ) Need Help??


in reply to Number of elements in array

      Suggestion for lines on investigation welcomed

OH Chilly Monk,
If I want to know the number of elements in an array I'd try one of two things:

# assume two arrays with a number of elements # @rray1 & @rray2 my $elements_1 = scalar @rray1; # or my $elements_2 = $#rray2 + 1;
Either of the two will work.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995390]
help
Chatterbox?
[Discipulus]: ;=) can be an idea for another killing oneliner..
Eily used google. The lazy internet equivalent of grep
[karlgoethebier]: He!
[Eily]: Discipulus pretty much all oneliners are killing. Do you imagine how many people could be working if you asked them to do the same thing in C each time ? :P

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2017-07-21 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (320 votes). Check out past polls.