Just to pick a couple of nits in the interest of increasing
In that poem, the "m mmm" could be replaced with
any bareword simply because the poem "won't run"
and without strict, throwing around barewords
is unlikely to cause compilation errors.
However, if "m mmm" was used in code to actually match
something (being a silly way of writing "m//m"), then you
could never replace it with "mmmm".
First, m//m is pretty silly code itself. The empty pattern
means "reuse the most recent successful regex", and testing
(since I so doubt it is documented that I didn't even look
for it) shows that when using the empty regex this way, any
options are ignored (including /g!); note that this might
be considered a bug and get fixed some day, so don't rely
on that behavior. So it boils down to being the same as
m//, m//mg, m//g, or any other similar code.
But if we wanted to the code to compile to the same
optree, then we could replace "=~ m mmm" with "=~ mmm"
(note only 3 "m"s, not 4) provided we either didn't
use strict or used a version of Perl that
doesn't give an error in this case. However, in the
absence of "=~", replacing "m mmm" with "mmm" will change
the code from m//m (which matches against $_ since there
is no "=~") to 'mmm' (which is simply a string constant)
unless something else gets in the way such as
strict or the declaration of a subroutine
(but my friends call me "Tye")
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||