my @line; while(<>) { push @line, pack("C5", (@octet = /$rx/ ? 1, @octet : (0) x 5 ) ) . $_; } print map substr($_, 5), sort @line;