in reply to Re^2: Deleting Elements from an Array without their Index Number?
in thread Deleting Elements from an Array without their Index Number?

And map is a specialization of foreach+push.
my @not_coin; foreach (@array) { push(@array, $_ eq 'coin' ? () : $_); }
How does this help?

Replies are listed 'Best First'.
Re^4: Deleting Elements from an Array without their Index Number?
by diotalevi (Canon) on Jul 24, 2006 at 15:45 UTC

    How does this help? It's always good to know the more general form of your specializations. Knowing that grep is map+flat list, you can turn chained grep/map into single expressions to avoid traversing your entire list multiple times, once for each step in the chain.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊