I am still not quite "getting it" as far as what you want to do. The only information that I have available is what you have given me, which is ONE test case and by the way a lot longer than it needed to be. Its not appropriate to tell me: hey, this works in a lot of test cases that I haven't shown you.

Let's concentrate on the question at hand. I think you should be telling me exactly what you want in terms of output! I can only answer questions based on the info that I have!

What I am supposing is that you want to get the <TITLE> and the <BODY>. The following code does that.

#!/usr/bin/perl -w use strict; while (<DATA>) { if ( my ($title, $body) = ($_ =~ /<TITLE>.+?<p>(.+?)<BODY>.*?<p>(.*)/)[0,1] ) { print "<TITLE>\n$title\n\n", "<BODY>\n$body\n"; } } __END__ Prints:(I did re-format lines to 72 chars in my editor). <TITLE> Dogs may not smarter than 6-year-olds, but researchers suggest canines might be on par with 2-year-olds.< Psychologist Stanley Coren says, "W +e do know that dogs understand far more than we credit them with, from about 165 words to 250 words." Even better than understanding our word +s, dogs know our hand gestures and body postures. Dogs may, in fact, far exceed 2-year-olds when it comes to reading emotions. <BODY> Developmentally, 2-year-olds are generally more interested in themselves, while dogs do care how their people feel, and instantly recognize a change in emotion.< "While your dog can't comprehend that you just received a traffic violation, he can tell that you're upset t +he second you walk through the door," Coren says. "In fact, dogs can dete +ct some subtle changes which even adults can't," adds Coren. "We can't smell cancer or predict seizures, as dogs can."< When I posted this story on my Facebook Fan page recently (<a href=" http://www.new.facebook.com/pages/ Steve-Dale/50057343596?ref=ts"> www.new.f acebook.com/pages/Steve-Dale/50057343596?ref=ts, or simply type Steve Dale into the Facebook search), I received some interesting responses:< Kelle: "Heck, my Italian Greyhound is smarter than most college students."< Karen: "Depends on how you define smart.

In reply to Re^3: Some portion of the text missing by Marshall
in thread Some portion of the text missing by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.