in reply to Evaluation Disorder

Is that somehow incorrect? bleh() will return either a sorted list of its arguments @_, or 0 (sorted, to no avail).

So you would expect to see the sorted list of input parameters, no?
sub bleh { if (@_) { return sort @_; } else { return sort 0; } }
Same thing, really, except that ?: doesn't use any BLOCKs.

Replies are listed 'Best First'.
Re: Re: Evaluation Disorder
by MeowChow (Vicar) on Apr 06, 2001 at 08:44 UTC
    Update: D'oh I am completely wrong .. didn't catch the precendence (I thought the sort was coming before the trinary ?: )
      ?: binds tighter than a function, so it takes precedence, yes.
      sub bleh { sort @_ ? @_ : 0; }
      Which is the same as:
      sub bleh { sort (@_ ? @_ : 0); }
      But perhaps you meant:
      sub bleh { (sort @_) ? @_ : 0; }
      Though I'm not really sure what you mean by this at all, since you aren't really using the results of the sort for any constructive purpose.