Re: if something equals nothing

2001-07-17 Thread Jos I. Boumans
Try this: unless( $options{a} && $options{b} ) { do_stuff } if both of those 2 keys have a value in the hash, the && will return true, and the do_stuff won't get exuted you can also use if( !$foo && !$bar ) or some construct like that, but i find that less legible... also, if you want to have

Re: if something equals nothing

2001-07-17 Thread Bradford Ritchie
; > } > > - Original Message - > From: "Mooney Christophe-CMOONEY1" <[EMAIL PROTECTED]> > To: "Perl Beginners" <[EMAIL PROTECTED]> > Sent: Tuesday, July 17, 2001 12:59 PM > Subject: RE: if something equals nothing > > > > Exactly

Re: if something equals nothing

2001-07-17 Thread Tyler Longren
;[EMAIL PROTECTED]>; "Perl Beginners" <[EMAIL PROTECTED]> Sent: Tuesday, July 17, 2001 1:26 PM Subject: Re: if something equals nothing > On Tue, 17 Jul 2001, Tyler Longren wrote: > > > That doesn't seem to work. I want if a variable doesn't equal anythin

Re: if something equals nothing

2001-07-17 Thread Paul
Mooney Christophe-CMOONEY1" <[EMAIL PROTECTED]> > To: "Perl Beginners" <[EMAIL PROTECTED]> > Sent: Tuesday, July 17, 2001 12:59 PM > Subject: RE: if something equals nothing > > > > Exactly like that, except using 'eq' instead of '==

Re: if something equals nothing

2001-07-17 Thread Brett W. McCoy
On Tue, 17 Jul 2001, Tyler Longren wrote: > That doesn't seem to work. I want if a variable doesn't equal anything, > then do something. Here's a piece: > if ($options{a} eq "" && $options{a} eq "") { You are comparing the same thing here twice??? How about if ( !defined($options{a}) && !def

Re: if something equals nothing

2001-07-17 Thread Tyler Longren
g behind them, the usage should be printed then too. Thanks everyone, Tyler - Original Message - From: "daniels tashi robert" <[EMAIL PROTECTED]> To: "Mooney Christophe-CMOONEY1" <[EMAIL PROTECTED]> Cc: "Perl Beginners" <[EMAIL PROTECTED]> Sent: Tuesda

RE: if something equals nothing

2001-07-17 Thread Mooney Christophe-CMOONEY1
To: Mooney Christophe-CMOONEY1; Perl Beginners Subject: Re: if something equals nothing That doesn't seem to work. I want if a variable doesn't equal anything, then do something. Here's a piece: if ($options{a} eq "" && $options{a} eq "") {

RE: if something equals nothing

2001-07-17 Thread daniels tashi robert
It's worth mentioning that there are a few different kinds of nothings. The ones I know that apply to ordinary (scalar) variables are the number zero, the empty string, with or without a null character to terminate it, boolean false, and undef, the value of variables that don't exist yet. A lot

Re: if something equals nothing

2001-07-17 Thread Brett W. McCoy
On Tue, 17 Jul 2001, Tyler Longren wrote: > How do I do: > if ($something == "") { > # do something > } > > in perl? You can do it that but use ne instead == (that's for numeric values only), but since an empty string returns false in a boolean context, you can say: if(!$something) { #..

Re: if something equals nothing

2001-07-17 Thread Tyler Longren
ristophe-CMOONEY1" <[EMAIL PROTECTED]> To: "Perl Beginners" <[EMAIL PROTECTED]> Sent: Tuesday, July 17, 2001 12:59 PM Subject: RE: if something equals nothing > Exactly like that, except using 'eq' instead of '=='. > A slightly easier way, though,

RE: if something equals nothing

2001-07-17 Thread Mooney Christophe-CMOONEY1
Exactly like that, except using 'eq' instead of '=='. A slightly easier way, though, would be to say if (!$something) { ... blah blah ... } Since $something will return false in a boolean context (if it is empty) -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Tu