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

Re: problem with foreach

by neniro (Priest)
on Jun 16, 2006 at 07:39 UTC ( #555703=note: print w/replies, xml ) Need Help??


in reply to problem with foreach

EDIT: I'm to slow - see node above

You can fill the array in one step using qw, and you can count all 'b' in this array in one step using grep:

my @ar = qw /a b b a/; my $cnt = 0 ; $cnt = grep /b/, @ar;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://555703]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2016-12-08 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (133 votes). Check out past polls.