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


in reply to how to sort this?

The following sorts numerically by the number preceeding the 'x', then numerically by the number following the 'x':

@a = sort { my ($a1, $a2) = split(/x/, $a); my ($b1, $b2) = split(/x/, $b); $a1 <=> $b1 || $a2 <=> $b2 } @a;