in reply to Extracting subset from list: map unsuitable?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extracting subset from list: map unsuitable?
by loris (Hermit) on Apr 13, 2005 at 07:46 UTC |