Using Git for Windows, which includes Perl v5.24.1, I have successfully used this code to test that my match works for specific occurrences of this sequence of redundant html:

open $HTML, '+<', $libFile . '.html' or die 'Failed to open' . $libFil +e . '.html'; my $matchspotter = 0; my $remove = m/<div><div class="blue"><\/div><\/div>/; while ( my $line = <$HTML> ) { if( $line =~ m/<div><div class="blue"><\/div><\/div>/ ) { $matchspotter += 1; } #$line =~ s/$remove//; #print $HTML $line; } print $matchspotter; close $HTML or die 'Failed to close' . $libFile . '.html';

The match stops working when the variable $remove is used in the if statement, but I only use the variable to illustrate my intent. The commented out lines are the bit I'm struggling with.

Searching has suggested this is silly to try without a cpan solution, but i would particularly like to try. (I've not yet used any modules, I would like to share with other Git users, and searching for the solution narrowed to a cpan module reduces useful hits.)


In reply to Strip specific html sequence by koober

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.