Here is my text file\n
I want to save a bunch of\n
charcaters before the keywords\n
for example the keywords might be\n
the phrase: these are my keywords\n
I want to save a bunch of characters\n
after the keywords too so I have\n
context\n
\n
The keywords may appear multiple\n
times in any given file and may\n
span across lines like so: these are\n
my keywords. This is one reason\n
I was using slurp instead of reading\n
in line by line
####
#!C:/Perl/bin -w
use File::Slurp;
my $filetext= read_file("input.txt");
while($filetext=~ m{(.{30}(these\s+are\s+my\s+keywords).{30})}gis)
{
print "$1\n";
}
##
##
keywords might be
the phrase: these are my keywords
I want to save a bunch of cha
ay
span across lines like so: these are
my keywords. This is one reason
I was us