http://www.perlmonks.org?node_id=1023448


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.