in reply to How do I extract the data that comes after a certain word?

Why use Perl $POSTMATCH or $'. when you can easily do like so:

my $string='hello I went to the store yesterday and the day after an +d the day after'; if($string=~m/.+?(yesterday.+?after).+?$/i){ print 'Summary: ',$1,$/; ## print yesterday and the da +y after }

Please check the following for some details.
perldoc -v $`
perldoc -v $&
perldoc -v $'

Replies are listed 'Best First'.
Re^2: How do I extract the data that comes after a certain word?
by MiriamH (Novice) on Jun 19, 2012 at 14:58 UTC
    Whenever I try to modify this script to work for a much larger string, nothing happens. I think its because the words "Summary" and "Description" (Which is what I'm scraping between in my real script) keep on repeating. Is there a way to write it as a foreach loop to make it keep going through the script and writing everything it seems between the words "summary" and "description" every time its written??