my $file = '/path/to/file.txt'; open (FILE,"<$file") || die $!; read FILE, my $text, -s $file; close(FILE); print $1 if ($text =~ / Start(.*?) End/s);