in reply to Re^2: Why do I need parentheses here?
in thread Why do I need parentheses here?

Yes. ?PAT? and $_ =~ ?PAT? are equivalent, just like /PAT/ and $_ =~ /PAT/ are. (Aforementioned split is exceptional since it treats /PAT/ as qr/PAT/ or similar.)

Replies are listed 'Best First'.
Re^4: Why do I need parentheses here?
by rovf (Priest) on May 27, 2009 at 14:57 UTC

    Is there any difference between /PAT/ and qr/PAT/ ??? I thought this is *always* the same.

    -- 
    Ronald Fischer <ynnor@mm.st>
      /PAT/ (m/PAT/) is the match operator. qr/PAT/ compiles the pattern and returns the pattern without doing any matching. perlop
      $ perl -le'$_="abc"; print /(.)/;' a $ perl -le'$_="abc"; print qr/(.)/;' (?-xism:(.))

        Ah, thanks a lot. I confused this with Ruby.... I should not mix languages too much ;-)

        -- 
        Ronald Fischer <ynnor@mm.st>