SPUG: new member (and learner) w/ ONE quick syntax question
Marc M. Adkins
Marc.M.Adkins at Doorways.org
Mon Jun 24 14:59:45 CDT 2002
Not sure what you mean. You can do things like:
$boolean ? $alpha : $bool2 ? $bravo : $charlie
$boolean ? ($a > $b) : ($c < $d)
$boolean ? (func1($b), return) : (func2($c), func3($d))
I'm not real sure on the last one, I think it might be subject to scalar vs.
list context, and I wouldn't use it personally.
Actually, while I'm quite fond of the ternary operator myself, many
programmers (particularly those from non-C/C++/Perl backgrounds) don't
understand and/or despise it. Many programming organizations ban it
entirely under the assumption that it presents maintenance issues.
mma
> -----Original Message-----
> From: owner-spug-list at pm.org [mailto:owner-spug-list at pm.org]On Behalf Of
> Baker, Stephen M
> Sent: Monday, June 24, 2002 12:07 PM
> To: perl mongers (E-mail)
> Subject: SPUG: new member (and learner) w/ ONE quick syntax question
>
>
>
>
> when using the ternary operator ?, is the syntax:
>
> expression ? if_true : if_false;
>
> possible to modify so that if_true or if_false are compound
> expressions??
>
>
>
>
>
>
> Stephen Baker
> Intel Corporation Intern
> stephen.m.baker at intel.com
>
> ******************************************************************
> **********
> **************
> The information contained in this email are the opinions and views of the
> author(s), and are not on behalf of Intel unless specifically stated.
> ******************************************************************
> **********
> **************
>
>
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
> Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
> Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
> For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
> Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
>
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
More information about the spug-list
mailing list