in reply to Re: Best way to remove elem of for loop
in thread Best way to remove elem of for loop
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Best way to remove elem of for loop
by tobyink (Canon) on Apr 24, 2014 at 18:05 UTC | |
|
Re^3: Best way to remove elem of for loop
by Preceptor (Deacon) on Apr 25, 2014 at 09:48 UTC |