Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: how to sort this?

by gube (Parson)
on Mar 25, 2006 at 10:01 UTC ( #539166=note: print w/ replies, xml ) Need Help??


in reply to Re^2: how to sort this?
in thread how to sort this?

Hi sen try this it gives your exact output,

#!/usr/local/bin/perl @a1 = qw/1x1 1x12 12x3 10x1 4x12 4x1 1x1 22x3 2x1 4x0 12x1 1x2/; @out = sort { (split 'x', $a, 2)[0] <=> (split 'x', $b, 2)[0] } sort { (split 'x', $a, 2)[1] <=> (split 'x', $b, 2)[1] }@a1; print "@out";


Comment on Re^3: how to sort this?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2014-12-20 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (96 votes), past polls