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

func ?PATTERN?; is no different than func $x+1;. There's nothing special (or odd) about it.

I think I got it. So func ?PAT? is just another way of writing

func($_ =~ ?PAT?)

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^3: Why do I need parentheses here?
by ikegami (Patriarch) on May 27, 2009 at 14:17 UTC
    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.)

      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:(.))
Re^3: Why do I need parentheses here?
by Anonymous Monk on May 27, 2009 at 14:01 UTC
    Checking ;)
    C:\>perl -MO=Deparse,-p -e"sub foo{} foo ?bar? sub foo { } foo(?bar?); -e syntax OK
    Yes