in reply to Re: Deleting Elements from an Array without their Index Number?
in thread Deleting Elements from an Array without their Index Number?
I like how writing these as map+ternary makes it obvious that grep is just a specialization of map.
my @not_coin = map { $_ eq 'coin' ? () : $_} @array; # Or do you want to replace coin by undef? my @not_coin = map { $_ eq 'coin' ? undef : $_} @array;
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Deleting Elements from an Array without their Index Number?
by Anonymous Monk on Jul 24, 2006 at 15:18 UTC | |
by diotalevi (Canon) on Jul 24, 2006 at 15:45 UTC |