@a = map{ substr $_, 16 } sort map { m[...(\d+)...( \d+.\d+)...([a-z]4)...] or die "Illformed data '$_'"; pack 'A4dNA*', $3, $2, $1, $_ } @b;