johngg@abouriou:~/perl/Monks$ perl -Mstrict -Mwarnings -E ' my @list = do { no warnings qw{ qw }; qw{ 1,cat 2,dog, 22,mouse frog 11,eel 001,elk horse 002,bear 13,mink }; }; say for map { unpack q{x54A50} } sort map { pack q{NA50A50}, ( m{^(\d+),(\S+)} ? ( $1, $2 ) : ( 0, q{} ) ), $_ } @list;' frog horse 1,cat 001,elk 002,bear 2,dog, 11,eel 13,mink 22,mouse