in reply to Naked quotes work like m//?

A quoted string or a scalar has successfully bound via =~ as long as I've been doing Perl, since 5.6.1:

[21:40:24.90] P:\test>perl5.6.1 -wle" 'fred' =~ '(re)' and print $1" re [21:41:41.51] P:\test>perl5.6.1 -wle"$re = '(re)'; 'fred' =~ $re and p +rint $1" re

But if you need modifiers, then you need m//opts


Examine what is said, not who speaks.
"But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
"Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo         "Efficiency is intelligent laziness." -David Dunham
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

Replies are listed 'Best First'.
Re^2: Naked quotes work like m//?
by ihb (Deacon) on Dec 09, 2004 at 01:41 UTC

    But if you need modifiers, then you need m//opts

    For the "xism" modifiers (as I like to call them) you can use the (?imsx-imsx) and (?imsx-imsx:) assertions. See perlref for more on that.

    ihb

    See perltoc if you don't know which perldoc to read!
    Read argumentation in its context!

      Yes, I was thinking about the /gc modifiers. I've often wished that there were some way to embed these into a qr// prepared regex.

      If we had a reentrant regex engine, that concept might actually be meaningful:)


      Examine what is said, not who speaks.
      "But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
      "Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo         "Efficiency is intelligent laziness." -David Dunham
      "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon