Something nobody else seems to have picked up on yet is your assertion that both examples are 2 lines. It's true, but only until you want to uniquify more than one list!
Compare
my %tmp = map { $_ => 1} @foo; my @uniq_foo = sort keys %tmp; %tmp = map { $_ => 1} @bar; my @uniq_bar = sort keys %tmp; %tmp = map { $_ => 1} @baz; my @uniq_baz = sort keys %tmp;
with
use List::MoreUtils; my @uniq_foo = uniq @foo; my @uniq_bar = uniq @bar; my @uniq_baz = uniq @baz;
Four lines instead of six, and it's getting a lot harder to argue that the two approaches are equally readable.
Yes, you could also define your own uniq function, but why bother when it's been done for you already? If you're worried about people who don't have List::MoreUtils, then just copy the existing uniq function out of that into your own code (license permitting). You'll still be reusing ready-made, ready-tested CPAN code, and that's still usually better than reinventing the wheel.
In reply to Re: Module Bloat and the Best Solution
by Porculus
in thread Module Bloat and the Best Solution
by KurtSchwind
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |