in reply to Extracting subset from list: map unsuitable?

You should use grep.
my @allFruit = qw/apple apricot banana coconut/; my @someFruit = grep { m/^[ap]/ } @allFruit; print "no. of some fruit: " . scalar(@someFruit) . "\n"; print "some fruit: " . join('*',@someFruit) . "\n"; __OUTPUT__ no. of some fruit: 2 some fruit: apple*apricot
Boris

Replies are listed 'Best First'.
Re^2: Extracting subset from list: map unsuitable?
by loris (Hermit) on Apr 13, 2005 at 07:46 UTC

    Thanks to you and gaal. I knew it must be something obvious.

    loris