# New Ticket Created by (Randal L. Schwartz) # Please include the string: [perl #36354] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=36354 >
eq_set (I know, deprecated, but it's still broken) does this: sort { ref $a ? -1 : ref $b ? 1 : $a cmp $b } @$a1 I think the intent was to put all references at the beginning, and then compare everything else directly. Maybe not. Hard to tell. However, if the entire list is references (as it is with Class::DBI's t/04-*.t test), then the sort routine gets "-1" for every pairwise comparison. As this is undefined, the result is random, and apparently different on different machines, and different versions, and different compilers, as I've spent the last few hours diagnosing. If the purpose is merely to provide a *consistent* sorting, this will suffice: sort { (ref $a) cmp (ref $b) or $a cmp $b } @$a1 This puts all the references after all the non-references, then sorts all the items according to their stringification. I *think* that gets you 95% of the way there, if not 100%. Anyway... classic example of how *not* to write a sort sub. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!