Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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;

Comment on Re: problem with foreach
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2015-11-25 07:10 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (672 votes), past polls