Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Regex with Newline

by hardburn (Abbot)
on Aug 26, 2011 at 14:24 UTC ( #922649=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Regex with Newline
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://922649]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2014-08-02 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (54 votes), past polls