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