Re: Consolidate if/else

2002-07-16 Thread Connie Chan
D]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 17, 2002 4:54 AM Subject: Consolidate if/else > > Hello all, > > I'm trying to get this line to work > > (!$opt_Z) ? die "Must supply Market\n" : $mkt = $opt_Z; > > and I keep getting compiler

RE: Consolidate if/else

2002-07-16 Thread Shishir K. Singh
Better use defined on $opt_Z , cause it will die even if $opt_Z has 0 , '0' or space !! > > Hello all, > > I'm trying to get this line to work > > (!$opt_Z) ? die "Must supply Market\n" : $mkt = $opt_Z; >You need parens because assignment is lower precedence than ternary: > > (!$opt_Z) ?

RE: Consolidate if/else

2002-07-16 Thread Jeff 'japhy' Pinyan
On Jul 16, Bob Showalter said: > $mkt = $opt_Z or die "Must supply Market\n"; > >(n.b. "or" is needed instead of "||", since it has super low precedence) Well, it's not important here, since die() will end the process. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~

Re: Consolidate if/else

2002-07-16 Thread Jeremy Vinding
> (!$opt_Z) ? die "Must supply Market\n" : $mkt = $opt_Z; $mkt = $opt_Z || die "Must supply Market\n"; jjv -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Consolidate if/else

2002-07-16 Thread Tanton Gibbs
That's also kind of obfuscated...you might try die "Must supply Market\n" unless $mkt = $opt_Z; - Original Message - From: "Kevin Old" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 16, 2002 4:54 PM Subject: Consolidate if/else &

RE: Consolidate if/else

2002-07-16 Thread Bob Showalter
> -Original Message- > From: Kevin Old [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 4:54 PM > To: [EMAIL PROTECTED] > Subject: Consolidate if/else > > > > Hello all, > > I'm trying to get this line to work > > (!$opt_Z) ? die

Re: Consolidate if/else

2002-07-16 Thread Jeff 'japhy' Pinyan
On Jul 16, Kevin Old said: >I'm trying to get this line to work > >(!$opt_Z) ? die "Must supply Market\n" : $mkt = $opt_Z; > >and I keep getting compiler errors. You should reproduce the error so we don't have to, but I know the error already. Something like "cannot modify die in assignment"?

RE: Consolidate if/else

2002-07-16 Thread Nikola Janceski
precedence.. ?: has lower precedence than {} change it to: (!$opt_Z) ? die("Must supply Market\n") : $mkt = $opt_Z; > -Original Message- > From: Kevin Old [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 4:54 PM > To: [EMAIL PROTECTED] > Sub

RE: Consolidate if/else

2002-07-16 Thread Shishir K. Singh
>Hello all, >I'm trying to get this line to work >(!$opt_Z) ? die "Must supply Market\n" : $mkt = $opt_Z; >and I keep getting compiler errors. $mkt = (defined ($opt_Z)) ? $opt_Z : die("Must supply Market\n"); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [E

RE: Consolidate if/else

2002-07-16 Thread Timothy Johnson
Turn on warnings and use strict, and let us know what your errors are. -Original Message- From: Kevin Old [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 1:54 PM To: [EMAIL PROTECTED] Subject: Consolidate if/else Hello all, I'm trying to get this line to work (!$

Consolidate if/else

2002-07-16 Thread Kevin Old
Hello all, I'm trying to get this line to work (!$opt_Z) ? die "Must supply Market\n" : $mkt = $opt_Z; and I keep getting compiler errors. Basically I'm trying to consolidate: if (!$opt_Z) { die "Must supply Market\n"; } else { $mkt = $opt_Z; } Any ideas? Thanks, Kevin