in reply to Re^5: Pearls (not really) of Perl programming
in thread Pearls (not really) of Perl programming
I just could not resist to point out for general idea (I saw that in p5p list) but I forgot to recheck all details
But once we decided to be precise, let me make additional correction.
Requirement to return '-1', '0' and '+1' is too restrictive. According to perldoc -f sort:
So any negative and positive values are ok.parison order. If SUBNAME is specified, it gives the name of a subroutine that returns an integer less than, equal to, or greater than 0, depending on how the elements of the list are to be ordered. (The "<=>" and "cmp" operators are extremely useful in such routines.) SUBNAME may be a scalar variable
Best regards,
Courage, the Cowardly Dog
|
|---|