These bits of verse are a result of my having been obsessing over good examples of when the /s and /m modifiers should be used in regexes: see this node .

Poem number one:


slash-s means that dot
includes newlines as well
slash-m affects markers,
it allows you to tell
your regex that caret,
(and dollar, its friend)
match at line start and end,
not just string start and end.


Poem number two (limerick):


slash-s tells your regex that dot
includes newlines too (normally not)
slash m says that dollar
and caret can holler
"a match" when line edges are caught


Poem number three (kind of Dr Seuss mode):


m affects markers, the start-and-end signs
which anchor your regex to places in lines
they're caret and dollar, in case you don't know
they match special places, as listed below:
without m, respectively, "start/end of a string"
but with it, each line-start-and-end match these things

s affects one thing, the dangerous dot,
which matches all characters, no matter what,
there's only one thing that it won't match: newline,
to over-ride this you employ the s-sign
add slash-s to your regex and the period portion
matches newlines as well, so proceed with great caution...

--
“Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.”
M-J D

Replies are listed 'Best First'.
Re: Poetry about perl
by feanor_269 (Beadle) on Feb 26, 2003 at 16:59 UTC
    This just seems clunky... and I can't read it well at all. Seems less like a poem, more like funky formatting of a man page :/

    feanor_269