use strict; my $txt = do{ local $/;<>}; # slurp file from the cmd line my $lines = split /\n/,$txt; # use split in scalar context my $chars = length($txt); # find length of whole text print "Chars = $chars Lines = $lines\n";
In reply to Re: Count the number of lines in a file
by fletcher_the_dog
in thread Count the number of lines in a file
by pastorizah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |