home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!news.Brown.EDU!noc.near.net!meiko.com!mike
- From: mike@meiko.com (Mike Stok)
- Subject: Re: Empty IF-TRUE-EXPR in ?:
- Message-ID: <1992Jul22.105757.5332@meiko.com>
- Sender: news@meiko.com
- Organization: Meiko Scientific Corp.
- References: <BRENDAN.92Jul21221748@eff.org>
- Distribution: usa
- Date: Wed, 22 Jul 1992 10:57:57 GMT
- Lines: 31
-
- In article <BRENDAN.92Jul21221748@eff.org> brendan@eff.org writes:
- >
- >I was thinking, it'd be nice to be able to have
- >
- > $foo ? $foo : 4;
- >
- >be also available as
- >
- > $foo ? : 4;
- >
- >to avoid re-parsing the second case of $foo. (Where $foo could be any
- >arbitrarily large expression.)
-
- won't something like $bar = $foo || 4; do the trick?
-
- try ('' and 0 both evaluate to false):
-
- foreach $foo ('', ' ', 0, 99, 'gibberish')
- {
- $bar = $foo || 4;
- print "foo = <$foo>, bar = <$bar>\n";
- }
-
-
- Mike
-
- --
- The "usual disclaimers" apply. | ... many were weak and confused, succumbing
- Mike Stok | to drink or drugs whenever possible ...
- mike@meiko.com |
- Meiko tel: (617) 890 7676 | Hunter S. Thompson
-