http://www.perlmonks.org?node_id=922649


in reply to Regex with Newline

The while(<DATA>) only reads one line at a time. In the second example, the first regex replace will match the first line, while the second will match all lines (note that you'd be better off using chomp() for that purpose).

In the first example, there is no single line that will match that regex, so the replacement never happens.


"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.