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
In reply to Re: split a file into number of file based on line count
by imrags
in thread split a file into number of file based on line count
by asha80
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |