http://www.perlmonks.org?node_id=346659


in reply to Unexpected qr// behavior

[~]$ 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.

Replies are listed 'Best First'.
Re(2): Unexpected qr// behavior
by bart (Canon) on Apr 20, 2004 at 16:01 UTC
    To make things even more clear (I hope), I'll just add that you can pass modifiers to qr, just like you can for normal regexes, like this:
    $re = qr/<!--.*?-->/s; print $re;
    which prints
    (?s-xim:<!--.*?-->)
    That is: /s enabled, and /x, /i and /m disabled.