Subject: | segfault in List::Util::uniq when combined with sort |
`sort uniq @list` has issues...
test script:
use strict;
use warnings;
use List::Util 'uniq';
my @list = qw(1 2 a b 4 9 c a 2 4 1);
print "1 the sorted uniqed list is ", join(', ', sort(uniq(@list))), "\n";
print "2 the sorted uniqed list is ", join(', ', sort uniq @list), "\n";
on one machine (perl 5.14.2 x86_64-linux-gnu-thread-multi ubuntu), this produces:
1 the sorted uniqed list is 1, 2, 4, 9, a, b, c
Segmentation fault
on another machine (perl 5.25.0, darwin-2level OSX 10.10.5) it produces:
1 the sorted uniqed list is 1, 2, 4, 9, a, b, c
Argument "b" isn't numeric in sort at list.pl line 7.
Argument "a" isn't numeric in sort at list.pl line 7.
Argument "a" isn't numeric in sort at list.pl line 7.
Argument "c" isn't numeric in sort at list.pl line 7.
2 the sorted uniqed list is 1, 4, 2, 9, 4, 2, 1, a, b, c, a
perl 5.14.4, darwin-2level OSX 10.10.5:
1 the sorted uniqed list is 1, 2, 4, 9, a, b, c
Segmentation fault: 11
perl 5.16.3, darwin-2level OSX 10.10.5 (and also 5.18.4, 5.20.3, 5.22.0, 5.22.2):
1 the sorted uniqed list is 1, 2, 4, 9, a, b, c
Sort subroutine didn't return single value at list.pl line 7.