http://www.perlmonks.org?node_id=652787


in reply to Re^3: RFC: List::Extract
in thread RFC: List::Extract

i agree, especially since grep has the same 'unimplied' aliasing of $_.

Replies are listed 'Best First'.
Re^5: RFC: List::Extract
by doom (Deacon) on Nov 25, 2007 at 22:13 UTC

    i agree, especially since grep has the same 'unimplied' aliasing of $_.

    Right, that's what I meant about discarding changes being reasonable, but possibly in an "unperl-like way"

    Remember that with grep changes made to $_ propagate in both directions, effecting the source as well as the returned values: "Note that $_ is an alias to the list value, so it can be used to modify the elements of the LIST."

    That side-effect of changing the source values was probably a bad idea and getting rid of it in "extract" would be all to the good.

    It is a good point that it's hard to see why you would want to discard a modified $_ in the returned values -- if so, then why did you modify it?