in reply to Re: Idioms considered harmful
in thread Idioms considered harmful

map { MAPCLAUSE } grep { GREPLCAUSE }
Can be rewritten as:
map { GREPCLAUSE ? MAPCLAUSE : () }
For instance, if you want a list of the squares of the first five odd numbers, either of these will work.
@odds_squared = map { $_**2 } grep { $_%2 } 1..10; @odds_squared = map { $_%2 ? $_**2 : () } 1..10; Result: 1 9 25 49 81

-Blake