my $count = 0; while (<>) { $count ++; if ($count == 385 || $count == 770 || $count == 1155 || ..) { print "-" x 40, "\n"; } print; }