http://www.perlmonks.org?node_id=392163


in reply to Re: improve ugly flow control
in thread improve ugly flow control

In the same vein, but along a different angle:

foreach my $i ( 0 .. $#options, 'fail' ) { if( $i eq 'fail' ) { log_failure(); last; } if( exists $hash{ $options[ $i ] } ) { do_something( $options[ $i ] ); last; } }

Makeshifts last the longest.