koober has asked for the wisdom of the Perl Monks concerning the following question:
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.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strip specific html sequence
by haukex (Archbishop) on Dec 10, 2017 at 16:57 UTC | |
by koober (Novice) on Dec 10, 2017 at 17:43 UTC | |
|
Re: Strip specific html sequence
by poj (Abbot) on Dec 10, 2017 at 17:33 UTC | |
|
Re: Strip specific html sequence
by 1nickt (Canon) on Dec 10, 2017 at 14:14 UTC | |
by koober (Novice) on Dec 10, 2017 at 17:27 UTC | |
by AnomalousMonk (Archbishop) on Dec 10, 2017 at 18:15 UTC | |
by 1nickt (Canon) on Dec 10, 2017 at 18:01 UTC | |
|
Re: Strip specific html sequence
by koober (Novice) on Dec 10, 2017 at 14:02 UTC | |
by hippo (Archbishop) on Dec 10, 2017 at 16:42 UTC |