my $file = '/path/to/file.txt'; open(IN,"<$file") || die $!; read IN, my $html, -s $file; close(IN); $html =~ s/(.*?)/$1/s;