Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Insert lines into specific stanza line

by toolic (Bishop)
on Aug 13, 2010 at 18:55 UTC ( [id://854979]=note: print w/replies, xml ) Need Help??


in reply to Insert lines into specific stanza line

Just detect the closing stanza tag, then add lines before it:
use strict; use warnings; while (<DATA>) { print "extra line\n" if m{</stanza>}; print; } __DATA__ <stanza 12.34.56.78> sl1 this is my line sl2 justanotherline </stanza>

prints out:

<stanza 12.34.56.78> sl1 this is my line sl2 justanotherline extra line </stanza>

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2024-04-18 16:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found