in reply to split a file into number of file based on line count
You can use an array to store the file and use scalar @arr to get the array size.my $i =0; open (FILE, "myfile.txt"); while (<FILE>) { ++$i; if($. == 10) { print $_; print "\n Reached\n" } } print $i;#will print number of lines in the file
|
|---|