http://qs1969.pair.com?node_id=324315

Hoot has asked for the wisdom of the Perl Monks concerning the following question:

Hi Say I have a poem called:

A Beautiful Poem
Mary had a little lamb, little lamb, little lamb
Mary had a DOG but everywhere that mary went the lamb was
sure to go even though it did not like the dog very much.

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?