(simplified to some extent)
the two
/'s specify the matching operator (also seen as
m//). this match operator allows you to search for certain
regular expressions in a string. in this case, you are searching for 'is' which gets
captured by the parentheses. this means that 'is' gets stored in the
\1 variable. so you are searching for 'is' then a single space, then another 'is'. so where are you searching? well, the matching operator defaults to the
$_ special variable (doesn't everything?). so you are looking in
$_ for 'is is'. you can also specify a string to search in using the
binding operator =~. so this expression could also be written as:
$_ =~ m/is is/ # or
$_ =~ m/(is) \1/
the parentheses around the statement simply means that this is a test (for an if or a while or something).
you should really check out the perlre manpage or 'Learning Perl' by O'Reilly or something for a much more detailed explanation of regular expressions.
jeff
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
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:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.