in reply to Falling through Perl 5.10 switch statement
The Imp of the Perverse still wonders if it is possible to directly "goto" (maybe that's a hint right there...) the next block, skipping the when check.
Well, goto itself won't work in my perl 5.9.4:
use feature qw(say switch); my $data = 1; given($data) { when (1) { say 'one'; goto two; } when (2) { two: say 'two' ; } default { say 'something else'; } }
This prints:
one panic: goto at /tmp/test line 5.
Interesting error message though.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Falling through Perl 5.10 switch statement
by Trizor (Pilgrim) on Apr 07, 2007 at 20:33 UTC | |
by ikegami (Patriarch) on Apr 07, 2007 at 21:37 UTC | |
by betterworld (Curate) on Apr 09, 2007 at 02:03 UTC | |
|
Re^2: Falling through Perl 5.10 switch statement
by ysth (Canon) on Apr 08, 2007 at 06:09 UTC | |
by Anonymous Monk on Apr 16, 2007 at 08:01 UTC |