use strict; use warnings; my $content = "

sample table

 

"; my $x = qr{

}; my $y = qr{

 

}; my $content_out = $1 if ($content =~ m|$x(.*)$y|s); print $content_out;