in reply to using the feature 'switch' in loops
But did you expected this behaviour when you used this feature for the first time?
Long time ago, when switch was first introduced, I decided never to bother with it :) I don't have expectations
But if you use given/when then last controls the outer loop because given isn't a loop like foreach
use feature "switch"; for my $i ( 'i','q' ){ given( $i ){ when( 'i' ){ print "i\n"; last; } when( 'q' ){ print "q\n"; last; } } } __END__ i
|
|---|