in reply to Extracting subset from list: map unsuitable?

As the others pointed out, use grep.

map evaluates the expression for each element of the list and returns it's result. In your case, since 2 elements of @allFruit do not fullfill the if-statement, for these undef is returned, so you still get 4 elements.

see grep and map for the diferences between the two.

Paul