in reply to Strip specific html sequence

open $HTML, '+<',...
print $HTML $line;

You can't edit an existing file like that, use separate file handles for read/write

#!perl use strict; use warnings; my $libFile = 'testfile'; my $filename = $libFile.'.html'; my $remove = '<div><div class="blue"><\/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;
poj