foreach ( @data ) { my $seq = /start/ .. /stop/; next unless $seq > 1 && substr($seq, -2) ne 'E0'; # do_stuff }