in reply to Puzzeled about Sorting
In numeric context given by the first comparison, undef, 0, and all the alphabetic strings evaluate to numeric zero. Being equal in numeric context, the comparison evaluates to 0 and the dictionary sort order kicks in. In string context undef is the empty string, which sorts first, then '0', then the alphabetic quantities in lexicographic order.
Here's an example worth working out in your head before you try it: $ perl -e'print join( ", ", sort {$a<=>$b || $a cmp $b} qw/7 000 07 00 007 0/, "0 but true"), $/'
After Compline,
Zaxo
|
|---|