[sf-perl] Sort subroutine didn't return single value at -e line 1.

George Hartzell hartzell at alerce.com
Fri Apr 5 14:57:21 PDT 2013

George Hartzell writes:
 > [...]
 > It seems to be using 'uniq' as it's sorting block.
 > This works
 >       perl -wle 'use Data::Dumper; use List::MoreUtils "uniq";  print \
 >         Dumper [sort {$a <=> $b} uniq (3,1,3,2)]'
 > Not sure *why* yet though.

Ah, there it is.  First line of perldoc -f sort

       sort SUBNAME LIST

You can specify a subname to use as the pairwise sorting function.


More information about the SanFrancisco-pm mailing list