$a="stuff
Header
1 2 3 4
Trailing Info"; print $a if $a=~s#\A.*?(.*<\/tr>).*?\Z#$1#smi;