[danger:jandrew:~]$ cat blah.pl #!/usr/bin/perl -w use strict; my @data = qw/one start two three stop four/; foreach (grep {not (/^start/../^stop/) =~ /^1?$|E/ } @data) { print "o> $_\n"; } [danger:jandrew:~]$ perl5.00503 blah.pl o> two o> three [danger:jandrew:~]$ perl5.6.1 blah.pl o> one o> start o> two o> three o> stop o> four #### my @data = qw/one start two three stop four/; foreach (grep {not ((/^start/../^stop/) =~ /^1?$|E/) } @data) { print "o> $_\n"; } # or: my @data = qw/one start two three stop four/; foreach (grep {not +(/^start/../^stop/) =~ /^1?$|E/ } @data) { print "o> $_\n"; }