Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: (Golf) Keysort

by japhy (Canon)
on Feb 14, 2002 at 15:13 UTC ( #145460=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # this is LEXICAL sorting
    #2345678901234567890123456789012345678901234567890123
    sub JAPHY {
    sort{(*-,*+)=map[/^\s*(0|-?[1-9]\d{0,8})(.*)$/],$a,$b
    ;@-?@+?$-[0]-$+[0]||$-[1]cmp$+[1]:-1:@+?1:$a cmp$b}@_
    }
    
  2. or download this
    #234567890123456789012345678901234567890123456789
    sub JAPHY {
    (*-,*+)=map[/^\s*(0|-?[1-9]\d{0,8})(.*)$/],$a,$b;
    @-?@+?$-[0]-$+[0]||$-[1]cmp$+[1]:-1:@+?1:$a cmp$b
    }
    
  3. or download this
    #2345678901234567890123456789012345678901234567890123456
    sub JAPHY {
    my($A,$B)=map[/^\s*(0|-?[1-9]\d{0,8})(.*)$/],$a,$b;
    @$A?@$B?$$A[0]-$$B[0]||$$A[1]cmp$$B[1]:-1:@$B?1:$a cmp$b
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://145460]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2022-01-27 21:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (71 votes). Check out past polls.

    Notices?