http://qs321.pair.com?node_id=1192593


in reply to Re^3: Sort undef
in thread Sort undef

Ah, thanks! :)

> you declared the lucky case to be the input

In my defence:

To be sure I also tried

 my @array =  ( ("")x3, (undef)x 3, qw/c b a/, ("")x3, (undef) x3 );

which still gives for cmp_undef1

[ "", "", "", "", "", "", "a", "b", "c", undef, undef, undef, undef, undef, undef, ]

which seems to be another "lucky case".

I don't know how "stable" is defined but it turns out to be not that easy to construct a counterexample without shuffle.

my @array =  ( undef, "", qw/c b a/, "", undef  );

->

["", "a", "b", "c", undef, "", undef]

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!