for (@input) { my $status = /$start/.../$finish/; if ( $status and $status !~ /E/ ) { do_this(); } else { do_that(); } }