Inserting new line to a string

  • Thread starter Deepan Perl XML Parser
  • Start date
D

Deepan Perl XML Parser

Hi all,
I am having a string like below:



<responseStatus>HTTP/1.1 200 OK</responseStatus>

<cookies></cookies>

<headers>

<header name="Accept-Ranges">bytes</header>

<header name="Content-Encoding">gzip</header>

<header name="Content-Length">5375</header>

<header name="Content-Type">text/html</header>

<header name="Date">Wed, 19 Mar 2008 10:00:30 GMT</header>

<header name="ETag">&quot;1667999478&quot;</header>

<header name="Last-Modified">Wed, 19 Mar 2008 10:00:01 GMT</header>

<header name="Server">Cricbuzz- Blazing Fast</header>

<header name="Vary">Accept-Encoding</header>

</headers>

<content>

<contentLength>17958</contentLength>

<compression>70.069</compression>

<encodingScheme>gzip</encodingScheme>

<text><![CDATA[

<html>..<head>...</body>..<!-- The template body ends -->..</html>.

]]></text>

<mimeType>text/html</mimeType>

</content>



------------------------------------------------

I want to insert new line at the end of every end tag[ex:- </
responseStatus>].

Thanks,
Deepan
 
G

Gunnar Hjalmarsson

Deepan said:
I am having a string like below:

I want to insert new line at the end of every end tag[ex:- </
responseStatus>].

Even if I can't see the point, it's easily done using the s/// operator.

perldoc perlop (about the s/// operator)
perldoc perlrequick (about regular expressions)
perldoc perlretut ("- )
perldoc perlre ("- )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top