$a <=> $b already forces $a and $b to be interpretted as numbers, always.It doesn't appear to with perl 5.8.2:
Output:use strict; use warnings; my $d1 = '2007030110300020070301133000'; my $d2 = '2007030110300020070301143000'; printf "plain = %d\n", ($d1 <=> $d2); { use bigint; printf "bigint = %d\n", ($d1 <=> $d2); } { use bigint; printf "bigint-0 = %d\n", (($d1 -0)<=> ($d2-0)); }
plain = 0 bigint = 0 bigint-0 = -1
In reply to Re^2: Sorting Puzzle (just sort)
by imp
in thread Sorting Puzzle
by willfould
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |