For instacne I searched for a period. It is found in the line "….is in 1996"." (this line is followed by) After that it was happily feeding modules through CPAN."
I need to print out the part after the word it , i.e was happily feeding modules through CPAN.
So again I searched for the match of a period. And after that I am to print the next line after that period, starting after the word it.
Hey Jake this is what I have so far.
open(AFILE, $ARGV[0]);
while(<AFILE>){
$string .= $_;
}
if($string =~ /\.|\?|,/){
print $string;
}else{
print "no match";
}
I tried doing the way your were saying and using the:
@wordsAfterPeriods = $sentence =~ /(?<=\. *)\w+/g
but I was getting a compilation error with this.
How can I fit this @ wordsAfterPeriods into what I have so far?
Thanks again for helping me!













$sentences = "the dog ate my homework. now is the time for all good programmers to take it to the limit.";
@wordsAfterPeriods = $sentence =~ /(?<=\. *)\w+/g;
print @wordsAfterPeriods;
it’s kind of magic! if there are words after periods , it prints them otherwise it prints nothing!
you could add
print "nothing" unless length @wordsAfterPeriods;