while (my $line=<$file>) { for my $i (1..3) { ... stuff you want to do ... } }