Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
[~]$ perl -le '$re = qr/<!--.*?-->/; print $re;' (?-xism:<!--.*?-->)
As you can see, the qr// specificly turns off all options for the regex that you don't specify, which is why adding the /s afterwards doesn't make any difference.

As for whether this is a good thing or not, I can see arguments either way.

  • For: When you created the RE, you didn't say you wanted that option, so Perl makes sure that this particular part of the RE doesn't have that option. This is probably more usful when building a large RE up from smaller parts, and you want the different parts to act differently with regards to the various options.
  • Against: Like you saw, adding the /s didn't do what you meant. And Perl, after all, is usually very DWIMy.

In reply to Re: Unexpected qr// behavior by Paladin
in thread Unexpected qr// behavior by pbeckingham

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • 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, 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (2)
    As of 2018-04-19 21:53 GMT
    Find Nodes?
      Voting Booth?