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;
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
In reply to Re^2: Deleting Elements from an Array without their Index Number?
by diotalevi
in thread Deleting Elements from an Array without their Index Number?
by Spidy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |