“isn't numeric” error in “sort” after “uniq”
问题 use List::MoreUtils 'uniq'; print join ", ", sort uniq ("b", "a", "a"); results in Argument "a" isn't numeric in sort at ... print join ", ", uniq sort ("b", "a", "a"); works as expected. print join ", ", sort {$a cmp $b} uniq ("b", "a", "a"); works too - but what is the problem with the first example? 回答1: That code falls under the sort invocation of sort SUBNAME LIST ... If SUBNAME is specified, it gives the name of a subroutine that returns an integer less than, equal to, or greater than 0