Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Sort an array of strings based on two fields

by BrowserUk (Pope)
on Mar 14, 2013 at 10:18 UTC ( #1023448=note: print w/replies, xml ) Need Help??

in reply to Sort an array of strings based on two fields

Using the GRT:

print for @a;; xxxxxx.2013-2.yyyyy xxxxxx.2013-11.yyyyy xxxxxx.2013-10.yyyyy xxxxxx.2012-52.yyyyy xxxxxx.2013-3.yyyyy xxxxxx.2012-51.yyyyy xxxxxx.2012-50.yyyyy xxxxxx.2013-1.yyyyy xxxxxx.2013-4.yyyyy @b = map{ unpack 'x[NN]a*', $_ } sort map{ m[(\d{4})-(\d+)]; pack 'NNa*', $1, $2, $_ } @a;; print for @b;; xxxxxx.2012-50.yyyyy xxxxxx.2012-51.yyyyy xxxxxx.2012-52.yyyyy xxxxxx.2013-1.yyyyy xxxxxx.2013-2.yyyyy xxxxxx.2013-3.yyyyy xxxxxx.2013-4.yyyyy xxxxxx.2013-10.yyyyy xxxxxx.2013-11.yyyyy

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023448]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2018-05-20 14:16 GMT
Find Nodes?
    Voting Booth?