Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Exiting the inner loop of a nested loop

by revdiablo (Prior)
on Apr 13, 2006 at 23:38 UTC ( [id://543253]=note: print w/replies, xml ) Need Help??


in reply to Exiting the inner loop of a nested loop

I'm not sure I fully understand your question, but if I read it correctly, I think you might just be looking for next:

for my $digit (1 .. 3) { for my $char ('a' .. 'c') { next if $char eq 'b'; print "$digit $char\n"; } }

Or am I missing something?

Update: I just noticed you said you tried next, as well as last and redo, but you never really explained why those didn't work for you, what they did that you weren't expecting, etc. Can you give further clarification?

Log In?
Username:
Password:

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

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

    No recent polls found