my @old = qw(20120301Customer100 20120402Alsocust200 20130102Nothercu300); my (@new, $item); @new = sort { substr($a, 8) cmp substr($b, 8) } @old; for $item(@new) { say $item; }