You do not want map(), you want grep().
my @filtered = grep { -d $_ } @ar; # or my @filtered = grep -d $_, @ar;
map() means "process the elements one after another and give me the results", while grep() means "give me only those elements of the list that match the condition".
Jenda
Enoch was right!
Enjoy the last years of Rome.
In reply to Re^2: Best way to remove elem of for loop
by Jenda
in thread Best way to remove elem of for loop
by HarryPutnam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |