use strict; use warnings; print sort {substr ($a, 9, 4) cmp substr ($b, 9, 4)} __DATA__ ...