in reply to PERL regex modifiers for m//

"m" affects "^" and "$".

"s" affects "."

How can one compare two independent things?

  • Comment on Re: example of 'm / / m' related example and compare to 'm / / s'

Replies are listed 'Best First'.
Re^2: example of 'm / / m' related example and compare to 'm / / s'
by educated_foo (Vicar) on Dec 05, 2011 at 13:26 UTC
    How can one compare two independent things?
    It's not so hard:
    • //m causes ^ and $ to match at newlines in the middle of your string, while //s causes . to match newlines.
    • The Nile is a river in Africa, while the Mississippi is a river in North America.
    • The -g flag turns on debugging information, while the -O flag turns on optimization.

      //m causes ^ and $ to match at newlines in the middle of your string, while //s causes . to match newlines.

      You're comparing using /m to not using /m, and using /s to not using /s. You're not comparing /m to /s.

      Your river example compares the location of the rivers, but there's no common aspect of /m and /s to compare.

      //m causes ^ and $ to match at newlines in the middle of your string, while //s causes . to match newlines.

      You're comparing using /m to not using /m, and using /s to not using /s. You're not comparing /m to /s.

      Your river example compares the location of the rivers, but there's no common aspect of /m and /s to compare.