Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Alpha number sort

by BrowserUk (Pope)
on Mar 25, 2005 at 01:15 UTC ( #442252=note: print w/replies, xml ) Need Help??


in reply to Alpha number sort

Is this the order you require?

P:\test>442237 a1.5 a1.5b a1.6 a1.6b a1.55 a1.55b linux-2.4.3.tar linux-2.4.28.tar linux-2.4.29.tar linux-2.4.29a.tar linux-2.10.6.tar linux-2.10.50.tar

If so:

#! perl -slw use strict; print map{ $_->[0] } sort { $a->[1] cmp $b->[1] } map { ( my $vstring = $_ ) =~ s[(\d+)][chr $1]ge; [ $_, $vstring ] } <DATA>; __DATA__ a1.5 a1.55 a1.55b a1.5b a1.6 a1.6b linux-2.10.50.tar linux-2.10.6.tar linux-2.4.28.tar linux-2.4.29.tar linux-2.4.29a.tar linux-2.4.3.tar

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco.
Rule 1 has a caveat! -- Who broke the cabal?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2021-07-31 19:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?