if you want to do this with regular expressions, which is in most cases a bad idea (arguably unless you know the precise structure of your html, such as being darned certain there won't be nested or unmatched tags, etc) .. consider:
## OP specified 'last <pre>' tag,
## so assume there can be more than one <pre>..</pre> block
## find all <pre> blocks, using non-greedy .*? and also
## get \n in the case where the html ends with a newline and no </pre>
## anchor to non-capturing match for closing </pre> or end of string
my @pre = ( $VAR1 =~ m{<pre>(.*?\n?)(?:</pre>|$)}isg );
## we want the last one
my $new_output = pop @pre;