in reply to Re^3: pattern matching question
in thread pattern matching question

When posting code, you need to wrap it in <code> tags so it doesn't get mangled - see Markup in the Monastery.

Command line switches are documented in perlrun. The switches -w, -Mstrict, -l, and -e enable warnings, strict, automatic chomps and one-liner execution respectively.

When you have questions about regular expressions, the go-to sources are perlre and perlretut. In this case, Assertions in perlre says

\z  Match only at end of string

and Modifiers in perlre says:

m Treat string as multiple lines. That is, change "^" and "$" from matching the start or end of the string to matching the start or end of any line anywhere within the string. s Treat string as single line. That is, change "." to match any character whatsoever, even a newline, which normally it would not match. Used together, as /ms, they let the "." match any character whatsoever, while still allowing "^" and "$" to match, respectively, just after and just before newlines within the string. x Extend your pattern's legibility by permitting whitespace and comments. Details in /x

See also /x.