my $beginString = "SEARCH"; my $endString = "TEST"; my $fileContent; open(my $fileHandler, $inputFile) or die "Could not open file '$inputF +ile' $!"; { local $/; $fileContent = <$fileHandler>; } close($fileHandler); if($fileContent =~ /\b$beginString\b(.*?)\b$endString\b/s){ my $result = $1; print $result; } print Dumper($fileContent);
In reply to Perl reading in a file and getting a string in between two strings on different lines by victorz22
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |