in reply to loop by line on a file
If you want to loop through your entire file 5 times, then you can use seek to get back to the start of the file, then put everything inside another loop:
open my $fh,"+<four_comma.txt" or die "Cannot open text $!"; my $i=0; for (1..5) { while(<$fh>){ say $_; say ++$i; } seek $fh, 0, 0; }
|
|---|