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


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";