Because you're matching against $_, which only contains a single line of __DATA__ at any given time. Here's a fix:
{ # Read all of __DATA__ into $_: local $/; $_ = <DATA>; } while (/(\d)\n{2}/g) { print "$1\n"; } __DATA__ Line 1 Line 2 Line 3 Line 5 Line 6 Line 7 Line 9
In reply to Re: Multiple newline regex
by ikegami
in thread Multiple newline regex
by rhythmicus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |