JavaFan,
Yes, it would have produced the same unexpected results but I would have also had to move:
my $hs = HTML::Strip->new();
higher in the file since I prefer to list all my subs at the bottom rather than the top of my file.

I am not sure I understand what you mean by (mis)using state. Is it not intended to ensure a variable is only initialized once? My expectation was that it was parsing from a clean state - primarily because I hadn't properly RTFMd - I didn't realize $hs was maintaining state.

I guess what you are saying is that in the end, after I realized what was going on I should have made the code more clear. I think adding a comment would suffice:

$hs->eof(); # ensure each call to parse() is from a clean slate

That is in fact what I intend and what the module offers to allow it. If I have completely misunderstood you, please clarify. If you just disagree then I note your objection but do not agree with your position.

Cheers - L~R


In reply to Re^2: Another Reason RTFMing Is A Good Thing by Limbic~Region
in thread Another Reason RTFMing Is A Good Thing by Limbic~Region

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.