clean solution for List::MoreUtils::uniq hack
[perl/list-index.git] / lib / List / Index.pm
index f703d974ebabfdea316db90cd5764c2a9bea45f2..e56d7713be5f5e113c7152b8a19f49e904d79b61 100644 (file)
@@ -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 );