Re: nested checks

2001-06-15 Thread charles
> > When you say: > > if ($add_alias) { ... } > > You are testing to see if $add_alias is true. If $add_alias = 0, the block > won't be executed. 0 may be a valid value for $add_alias to have. If this > is the case, you probably should be testing to make sure $add_alias is > defined, meanin

Re: nested checks

2001-06-15 Thread Karthik Krishnamurthy
On Thu, Jun 14, 2001 at 01:51:29PM -0500, [EMAIL PROTECTED] wrote: > i am running through a series of if/elsif checks on a variable: > > if (($add_alias) && ($add_destination) && (!$selection)) { > >if ( $add_alias =~ /[^\w\.\-]/ ) { > >} elsif ( $add_destination !~ /\@/ ) { > >} e

Re: nested checks

2001-06-14 Thread Michael Fowler
On Thu, Jun 14, 2001 at 11:10:43PM -0500, [EMAIL PROTECTED] wrote: > > Format to taste, of course. Your checks on $add_alias, $add_destination, > > and $selection should also probably be checks for defined'ness, not truth. > > 0 is false, but, according to your definition of what $add_alias shoul

Re: nested checks

2001-06-14 Thread charles
> If this is really what your code looks like, with unused blocks and all, > it's better written as: > > if ( $add_alias && $add_destination && !$selection > && $add_alias !~ /[^\w\.\-]/] > && $add_destination !~ /\@/ > ) { > # ... code goes here ... > }

Re: nested checks

2001-06-14 Thread Michael Fowler
On Thu, Jun 14, 2001 at 01:51:29PM -0500, [EMAIL PROTECTED] wrote: > i am running through a series of if/elsif checks on a variable: > > if (($add_alias) && ($add_destination) && (!$selection)) { > >if ( $add_alias =~ /[^\w\.\-]/ ) { > >} elsif ( $add_destination !~ /\@/ ) { > >} e

nested checks

2001-06-14 Thread charles
i am running through a series of if/elsif checks on a variable: if (($add_alias) && ($add_destination) && (!$selection)) { if ( $add_alias =~ /[^\w\.\-]/ ) { } elsif ( $add_destination !~ /\@/ ) { } else { open(FILE, ">>$filename"); print FILE "$add_alias\@$domain\t$add_