open(FILE, "yourfile") or die; my $file = do {local $/; }; $file =~ m!(.*?

.*?

.*?

)!is; my $match = $1;