NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
sort with code ref (Score:2)
It would really help if
sortwould take a subroutine reference but it doesn't it takes a block or a subroutine name. Grump.Thankfully, you're wrong.
sortis happy to take a code ref.That definitely would appear to work, correctly printing the numbers from 1 to 20 in reversed order, on any perl I throw it at, from 5.6.1 to 5.10.0.
Re:sort with code ref (Score:2)
Reply to This
Parent
Re: (Score:1)
Yeah, the
sortfunction has a bunch of terrible, horrible, awful special cases in place that are supposed to DWIM but end up surprising me much of the time I usesortotherwise than by passing an explicit, inline comparator block.