Do you know where your variables are? | |
PerlMonks |
Re^3: fall through switch/case in perlby radiantmatrix (Parson) |
on Sep 07, 2004 at 15:40 UTC ( [id://389106]=note: print w/replies, xml ) | Need Help?? |
Your code will either not print anything, or it'll never finish printing.
You're right, I forgot the $junk--; after the print statement. That's a pretty bold statement, considering many languages do have a 'switch', perl6 will have a switch, there's Switch.pm, both the manual and the FAQ discuss it (without dismissing it as choicing a bad algorithm), and it has been on the wishlist since the very first release of Perl in 1987. I never said switch was bad code. Perl6 will have a switch because a lot of people want it, and it is very readable. However, switch statements are unbelievably over-used. I stand by my statement; chances are, if your algorithm needs switch, you can come up with a better algorithm. There are, of course, a few exceptions. As to your "considering many languages have a 'switch'", multiplicity does not correctness make.
-- $me = rand($hacker{perl});
In Section
Seekers of Perl Wisdom
|
|