in reply to Count number of lines in a STRING
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//;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Count number of lines in a STRING
by LanX (Saint) on May 12, 2010 at 09:57 UTC | |
by JavaFan (Canon) on May 12, 2010 at 10:10 UTC | |
by LanX (Saint) on May 12, 2010 at 10:48 UTC | |
|
Re^2: Count number of lines in a STRING
by danj35 (Sexton) on May 12, 2010 at 09:45 UTC |