use feature "switch"; for my $i ( 'i','q' ){ given( $i ){ when( 'i' ){ print "i\n"; last; } when( 'q' ){ print "q\n"; last; } } } __END__ i