Add 1 if you want to count an incomplete last line, and the string doesn't end with a newline.my $nr_of_lines = $str =~ tr/\n//;
In reply to Re: Count number of lines in a STRING
by JavaFan
in thread Count number of lines in a STRING
by danj35
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |