for (1..100) { print "$_ "; print "\n" if ($_ % 5 ==0); # add a break (or other string) every 5 elements }