sub codes_sorted { # do the GRT dance map { substr $_, 10 } sort map { /-(\d+)-([A-Z]{2})(\d+)/; pack('N',$1).$2.pack('N',$3).$_ } }