my @allFruit = qw/apple apricot banana coconut/;
my @someFruit = map { if ($_ =~ m/^[ap]/) { $_;} } @allFruit;
print "no. of some fruit: " . scalar(@someFruit) . "\n";
print "some fruit: " . join('*',@someFruit) . "\n";
####
no. of some fruit: 4
some fruit: apple*apricot**
####
no. of some fruit: 2
some fruit: apple*apricot