in reply to Re^3: Remove Duplicates from Array
in thread Remove Duplicates from Array
This seems like a strange construction (and yet, as you point out, it's what's in the List::MoreUtils source). Surely $h{$_}++ == 0 is the same as ! $h{$_}++ in this setting? I thought the main point of using the List::MoreUtils uniq was to avoid edge cases, but this seems to do nothing but replace a grep with an essentially equivalent map. (In particular, it doesn't do anything to avoid stringification of objects.)# List::MoreUtils::uniq sub LM_uniq { my %h; map { $h{$_}++ == 0 ? $_ : () } @_; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Remove Duplicates from Array
by mpeever (Friar) on Nov 03, 2008 at 00:18 UTC | |
by JadeNB (Chaplain) on Nov 03, 2008 at 15:22 UTC |