print for map{ unpack 'x[N] A*', $_ } sort map{ pack 'N A*', substr( $_, 1 ), $_ } qw[ A473 B659 C123 D222 E001 ];; E001 C123 D222 A473 B659