in reply to Extracting subset from list: map unsuitable?

As you've heard, grep is best. You could use map instead with this kind of construction: my @someFruit = map { /^[ap]/ ? $_ : ();} } @allFruit; The ternary picks either the array element or the empty list, depending on the match test result. The empty list does not create a new array element where undef would.

It would be silly to do this for your particular problem when grep fits so well, but it can be very handy for more complicated situations.

After Compline,
Zaxo