Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: if statement used in foreach-loop?

by PeterPeiGuo (Hermit)
on Dec 10, 2010 at 05:05 UTC ( [id://876378]=note: print w/replies, xml ) Need Help??


in reply to if statement used in foreach-loop?

The entire difference is centered on one thing - that "next" statement. "next" statement leads you to the next iteration (when the condition is satisfied), and skips the rest steps of this particular iteration. In some sense, your second piece of code is saying the opposite of your first piece (from the print statement's point of view).

Peter (Guo) Pei

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://876378]
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: (3)
As of 2024-04-19 22:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found