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


in reply to Sort undef

I think you can define your own sorting sub cmp_undef.

Something like

sub cmp_undef { my ( $a, $b ) = @_; return $a cmp $b if defined $a and defined $b; return $b cmp $a; # invert order otherwise } @$ResultsFinal = sort \&cmp_undef(...,...), @$ResultsFinal;

Untested!

Update:

wait this might go wrong if cmp_undef("",undef) returns 0. (Not sure)

So you'd need to treat the 3 extra cases for $a, $b being undef and return -1,0,1 accordingly.

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