in reply to Re^2: fall through switch/case in perl
in thread fall through switch/case in perl
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: fall through switch/case in perl
by Anonymous Monk on Sep 07, 2004 at 15:59 UTC | |
by radiantmatrix (Parson) on Sep 07, 2004 at 18:21 UTC | |
by demerphq (Chancellor) on Sep 14, 2004 at 12:09 UTC | |
by Anonymous Monk on Sep 07, 2004 at 23:11 UTC | |
by radiantmatrix (Parson) on Sep 08, 2004 at 13:25 UTC |