in reply to Reducing array

Here is a neat trick using a specially constructed reg-ex that matches /this|that|the|other|bit/ and then the ever invaluable grep().

my @array = qw(dog cat cow horse donkey chicken); my @items = qw(cat donkey); # make our magical reg-ex that will match what we don't want # note we must quotmeta literal strings before we bung em in a reg-ex my $re = join '|', map { quotemeta } @items; my $re = qr/$re/; # use qr// to compile our reg-ex my @fixed = grep { ! /$re/ } @array; # grep the results out print "@fixed" ;

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print