Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: sort empty string

by pijll (Beadle)
on Jul 29, 2003 at 16:36 UTC ( [id://278978]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to sort empty string

You can use a more complex sort routine. However, any extra code there will be executed for each comparison, O(N log N) times IIRC. As you are using a Schwartzian transform anyway, just make sure that empty strings are mapped to a value that sorts last. E.g. (untested):
@sorted = map { $_->[1] } sort { $a->[0] cmp $b->[0] } map { [ (length($all{$_}->[$sortValue])? '0' . $all{$_}->[$sortValue] : '1'), $_ ] } keys %all;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://278978]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.