Fair enough, but in TimToady's original, he had 'CASE'.($var+0) which avoids dieing.
P:\test>perl -le" print 1; $var = 'foo'; goto 'CASE'.($var+0); CASE0: +print 2;" 1 2
And that allows CASE0: to become the default.
The only situation this doesn't cover is when $var is undef'd; but then none of the other solutions handle that (except the do{ local $^W; $var + 0 }; I suggested).
In reply to Re^7: fall through switch/case in perl
by BrowserUk
in thread fall through switch/case in perl
by ykar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |