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
In reply to Re: Extracting subset from list: map unsuitable?
by rev_1318
in thread Extracting subset from list: map unsuitable?
by loris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |