Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Perl 5.10: switch statement demo

by Thilosophy (Curate)
on Dec 20, 2007 at 01:34 UTC ( #658034=note: print w/ replies, xml ) Need Help??


in reply to Perl 5.10: switch statement demo

but found it didn't produce the output I expected. Unlike C's switch statement, once a condition is met, the entire given construct is finished.

It has been pointed out that you can explicitly continue to produce the output you expected.

Please note, however, that the behaviour of continue is very much different from the fall-through in C, in that the next when condition is still being checked; in C, you go to the contents of the next case without any checks (which would not make much sense in a switch/case anyway).

So the C behaviour (which is difficult to reproduce with the Perl given construct,see this thread) would not produce your expected output either.


Comment on Re: Perl 5.10: switch statement demo
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2014-07-10 22:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (217 votes), past polls