[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Does Style Count? (formally, 'file tests')



On Thu, Oct 29, 1998 at 08:45:55PM -0800, Xah Lee wrote:
} 
} The "predicate ? expression1: expression2" construct in Perl is not a
} mere syntax sugar. It differs from "if then else" because the former
} is an expression and the latter is not. More specifically, the former
} returns a value. In practice, this means one can do:

It's also assignable:

(condition ? $a : $b) = something;

which also makes it different from if/then/else.

No one with any experience in C or Perl will not know what ?: does.
The common pitfall in Perl seems to be the occasional fight with
precedence, since there are more things in Perl than in C that have
lower precedence than ?:.

---
Paul Schinder
schinder@pobox.com



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch