in reply to Precedence of grep vs. ?:

Seems to me that everything to the right of the grep (or rather, the regex that is passed to grep) is evaluated as an expression to be passed in to grep. Without the parens, you're really doing:
grep( /regex/, @array ? 1 : 2 );
Randal will disagree, I'm sure, but I always say "when in doubt, use parens".

xoxo,
Andy
--
<megaphone> Throw down the gun and tiara and come out of the float! </megaphone>

Replies are listed 'Best First'.
Re: Re: Precedence of grep vs. ?:
by merlyn (Sage) on Oct 04, 2001 at 21:33 UTC
    Randal will disagree, I'm sure, but I always say "when in doubt, use parens".
    Why would you imagine I would disagree with that. That's a line directly from our llama teaching materials.

    Maybe we just disagree on how much is "doubt". {grin}

    -- Randal L. Schwartz, Perl hacker

      Why would you imagine I would disagree with that.

      Because you're also fond of saying "You need to write Perl in Perl", and I suspected that the precedence of such things would be one of those things that One Should Know.

      xoxo,
      Andy
      --
      <megaphone> Throw down the gun and tiara and come out of the float! </megaphone>