There is a bug on the perl interpreter. Internally, it expects the result of the comparison operator to fit in an integer, but in that case, it doesn't. It is represented as an NV (a double float) that at some point is forcedly coerced into an integer and that operation overflows returning a bad result.
As a workaround, just use the comparison operator (<=>) which knows how to handle any Perl internal representation for numbers correctly.
In reply to Re: Problem with a sort result
by salva
in thread Problem with a sort result
by kzwix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |