#!perl use strict; use warnings; my $libFile = 'testfile'; my $filename = $libFile.'.html'; my $remove = '
<\/div><\/div>'; open my $in, '<', $filename or die "Failed to read '$filename': $!"; my @array = <$in>; close $in; my $matchspotter = 0; for ( @array ) { if ( s/$remove//g ) { ++$matchspotter; } } print "\n$matchspotter lines replaced"; $filename = $libFile.'_chg.html'; open my $out, '>', $filename or die "Failed to write '$filename': $!"; print $out $_ for @array; close $out;