#!perl -wl # this will sort numerically by the first number found; and alphabetic +ally # if necessary # and of course it's schwartzian-transform-ized, because hey why not use strict; my @array = qw(POST100 XX1Z XX1A XX2B POST5 POST10 POST1 BOB1); foreach ( map { $_->[0] } sort { $b->[1] <=> $a->[1] || $a->[0] cmp $b->[0] } map { [ $_ , do { /(\d+)/; $1 } ] } @array ) { print; }
perl -e"\$_=qq/nwdd\x7F^n\x7Flm{{llql0}qs\x14/;s/./chr(ord$&^30)/ge;print"
In reply to Re: perl sorting
by pizza_milkshake
in thread perl sorting
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |