better use scalar split, counting the delimiter is unnecessary complexity.
DB<1> $a="1\n2\n3";$b=$a."\n" DB<2> print scalar split /\n/ for $a,$b 33 DB<3> print scalar tr/\n// for $a,$b 23
Cheers Rolf
In reply to Re^2: Count number of lines in a STRING
by LanX
in thread Count number of lines in a STRING
by danj35
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |