Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: error message in the end of the array looping?

by isotope (Deacon)
on May 30, 2006 at 02:15 UTC ( [id://552391]=note: print w/replies, xml ) Need Help??


in reply to error message in the end of the array looping?

See:
FIND_MATCH: { foreach my $a (@array) { if( $hash{$a} eq 'correct_value' ) { print 'Success'; last FIND_MATCH; } } warn "Didn't find a suitable match!"; }

By targeting the last at the outer block, if you find a match, you completely exit that block. Otherwise, if you make it all the way through the foreach loop without a match, you will hit the warning message right before exiting the block.


--isotope

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-26 03:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found