Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
"be consistent"
 
PerlMonks  

Re: Re: Re: How to sort hash tables alpha-numeric

by Aragorn (Curate)
on Oct 19, 2003 at 06:46 UTC ( [id://300367]=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 Re: Re: How to sort hash tables alpha-numeric
in thread How to sort hash tables alpha-numeric

The Schwartzian Transform is explained here by the person after who this sorting technique is named.

A modified version of the sorted routine which also takes the leading letters into account:

sub sorted { return map { $_->[0] } sort { $a->[1] cmp $b->[1] || $a->[2] <=> $b->[2] || $a->[3] <=> $b->[3] } map { [ $_, (/([A-Z]+)(\d+)(?:-(\d+)){1,2}/) ] } @_; }
The split function is replaced by a regex which returns a list of letters and the numbers.

Arjen

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://300367]
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.