On Thu, Jun 23, 2005 at 12:32:43AM +0200, Abigail wrote: > > If the purpose is merely to provide a *consistent* sorting, this will > > suffice: > > > > sort { (ref $a) cmp (ref $b) or $a cmp $b } @$a1
<snip> > sort (grep {ref} @$a1), sort (grep {!ref} @$a1) Neither of these works fully, though they do no worse than the existing code. Here's the two test cases: my $ref = \2; ok( eq_set( [$ref, "$ref", "$ref", $ref], ["$ref", $ref, $ref, "$ref"] ) ); ok( eq_set( [\1, \2, \3], [\3, \2, \1] ) ); The first works, the second does not. In the second the arrays are left in the same order by the sorts. This is because its sorting based on the reference, not the contents of the reference. As the function is discouraged I'm not going to put in the effort to repair it. But I will repair the sort function as recommended so that its at least consistent. -- Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern 'All anyone gets in a mirror is themselves,' she said. 'But what you gets in a good gumbo is everything.' -- "Witches Abroad" by Terry Prachett