Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Check if at least one element of array is bigger than X

by ambrus (Abbot)
on Apr 08, 2010 at 08:51 UTC ( [id://833464]=note: print w/replies, xml ) Need Help??


in reply to Check if at least one element of array is bigger than X

Forgive me if I'm traditional, but we had none of these problems when we used real for loops or while loops instead of these fancy new control structures.

for (my($i, $quit) = 0; !$quit && $i < @array; $i++) { if (10 < $array[$i]) { print "array element at index $i value $array[$i] is bigger th +an 10\n"; $quit++; } }

This is part joke, part serious.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found