|Perl: the Markov chain saw|
Storing Lines before and After patternby Hoot (Initiate)
|on Jan 27, 2004 at 00:41 UTC||Need Help??|
Hoot has asked for the wisdom of the Perl Monks concerning the following question:
Hi Say I have a poem called:
A Beautiful Poem
Is it possible to have DOG as the pattern to match and store everything before it in a variable and everything after it in another variable?
I have tried $` and $& and $' but can't get my head around the new lines etc.
I want to be able to capture the title of the poem and the poem itself and DOG.
Can somebody help me please?