From: Mischa POSLAWSKY Date: Sun, 15 Nov 2009 03:39:30 +0000 (+0100) Subject: clean solution for List::MoreUtils::uniq hack X-Git-Url: http://git.shiar.nl/perl/list-index.git/commitdiff_plain/86ab9954f77afe10ac66767d3d79bf2ce51a314d clean solution for List::MoreUtils::uniq hack --- diff --git a/lib/List/Index.pm b/lib/List/Index.pm index f703d97..e56d771 100644 --- a/lib/List/Index.pm +++ b/lib/List/Index.pm @@ -74,11 +74,9 @@ sub ranges { $lookahead = $context - $penalty; } - push @links, $link; + push @links, $link unless $links[-1] eq $link; } - use List::MoreUtils 'uniq'; - @links = uniq @links; for my $i (0 .. $#links - 1) { my ($link, $lastchar) = $links[$i + 1] =~ /(.*)(.)/; $link .= $lastchar le 'a' ? '.' : chr( ord($lastchar) - 1 );