in reply to Re^2: Add at the begining of text
in thread Add at the begining of text

#!/usr/bin/perl while(<DATA>){ s/(.*)<$/<p>$1<\/p>/g; print $_; } __DATA__ 9912290449 *In, a law prohibiting in United States went into effect.< In, a law prohibiting in United States went into effect.< 9912290450
Suppose the line is divided into two lines. How to add the start <p> tag at the start of the line. Now the ouptput is
9912290449 *In, a law prohibiting in United States <p>went into effect.</p> In, a law prohibiting in United States <p>went into effect.</p> 9912290450
How to add the <p> tag. Where the output should look like
9912290449 <p>*In, a law prohibiting in United States went into effect.</p> <p>In, a law prohibiting in United States went into effect.</p> 9912290450

Replies are listed 'Best First'.
Re^4: Add at the begining of text
by bv (Friar) on Sep 01, 2009 at 15:17 UTC

    Well, that's a new requirement. Now we need to parse English to find the beginning of the paragraph! Seriously, though, you would need to communicate some better constraints on your problem for me to be able to help further.

    print pack("A25",pack("V*",map{1919242272+$_}(34481450,-49737472,6228,0,-285028276,6979,-1380265972)))
      Please tell me how to tag the <p> tags
      __DATA__ [NEW] Dear Carolyn: My husband and I divorced after 42 years. It didn't tak +e long for him to find a replacement, but I was happy for him at the time.< them and let my grandchildren dig through her purse as if she were the +ir grandmother.< [OLD]
      into to NEW

      Dear Carolyn: My husband and I divorced after 42 years. It didn't take long for him to find a replacement, but I was happy for him at the time.

      them and let my grandchildren dig through her purse as if she were their grandmother.

      OLD