Note: split /\n/ is only an acceptable of splitting text into lines if you don't care about eliminating trailing blank lines.
$str = "this\nis my short\nstring\n\n"; $i=0; for (split /\n/, $str) { print(++$i, ": $_\n"); } print("\n"); $i=0; for ($str =~ /.*\n|.+/g) { # Just like <> print(++$i, ": $_"); }
In reply to Re^2: Multiline Regex
by ikegami
in thread Multiline Regex
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |