On Mon, Sep 30, 2002 at 12:52:47PM +0800, [EMAIL PROTECTED] wrote: [snip] > unless (defined $directory && defined $comment && defined $max_rows && > defined $max_cols && (!defined $saturation || abs($saturation) < 100)) { > # Print error messages > } > > WHAT'S HAPPENING: > Without setting $saturation... > A. Everything works just fine if all of the *required* variables are set. > B. Perl complains 'Use of uninitialized value in abs' if any of the > *required* variables are not set.
I cannot duplicate your problem. Given the code: perl -wle 'print "hi" if defined $bar && (!defined $foo || abs($foo) < 100)' I see no 'Use of uninitialized value' warnings, and no print. Are you certain the code you posted is what you're actually using? Is there relevant code prior to what you posted, such as initializations of your variables? > WHAT I EXPECT TO HAPPEN: > Without setting $saturation... > I thought that evaluation of the conditional would stop at the first > occurence of an undefined variable and that (!$defined $saturation || > abs($saturation) < 100) would _not_ be evaluated i.e., The abs() > portion of the test would not be performed. You are correct, this is how it would work. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]