Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: problem with foreach

by neniro (Priest)
on Jun 16, 2006 at 07:39 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://555703]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-23 20:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found