There is a bunch of stuff written in Perl that has lots and lots of functionality I do not want or need so I use the parts I want and skip the other stuff. I could rewrite it but why?

In this case you have supplied us with an input file that does not appear to be valid HTML, is incomplete, or both. I took the libertty of closing a few tags just to get the parser to stop complaining:

<r> <div class="JMWMJ"> <div class="toI8Rb OSrXXb usbThf">Sam Namett, MD - Physician - Inter +ventional Orthopedics ...Exosomes are nanovesicles (30-200 nm) found +in extracellular space of various cell types, and in biofluids; havin +g diverse functions including intracellular ... </div> <div class="Xxy7Vb"> <div class="BtwlAd"> <g-img style="width:16px;height:16px"> <img id="dimg_8" src="data:image/gif;base64,R0lGODlhAQABAI +AAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" /> </g-img> </div> </div> </div> </r>

Now to parse and grab a single element:

perl -MXML::Simple -e 'my $x = qq~./limit.html~; system cat =>$x; my $ +rx = XMLin($x); use Data::Dumper; print Dumper \$rx; print qq~\n\n$rx +->{div}->{div}->[0]->{content}~;'

Produces...

... $VAR1 = \{ + 'div' => { + 'div' => [ + { ... Sam Namett, MD - Physician - Interventional Orthopedics ...Exosomes ar +e nanovesicles (30-200 nm) found in extracellular space of vari\ ous cell types, and in biofluids; having diverse functions including i +ntracellular ...

The most interesting part being print qq~\n\n$rx->{div}->{div}->[0]->{content}~;

My point is this: if your input is legit then parsing and extracting from it becomes easier. Perhaps rather than rewrite a big script work on cleaning up the input for now and work on the script later when you have more time.

Celebrate Intellectual Diversity


In reply to Re: perl Mojo DOM CSS syntax issues by InfiniteSilence
in thread perl Mojo DOM CSS syntax issues 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.