nghosh has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I tried the following piece of code which is not working.
$v=1; $f=!($v); print "**$f**\n";
The Output is ****. However, if i do
$v=0; $f=!($v); print "**$f**\n";
Output is **1**.
It looks like !(1) does not return zero whereas !(0) indeed returns 1. What can be the reason behind this and what should i do to get 0 from 1 by logical not.thanks
nghosh
Edited by Ovid. 2005-07-27.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Logical expression evaluation
by ikegami (Patriarch) on Jul 27, 2005 at 15:47 UTC | |
by radiantmatrix (Parson) on Jul 27, 2005 at 17:00 UTC | |
Re: Logical expression evaluation
by davorg (Chancellor) on Jul 27, 2005 at 15:46 UTC | |
Re: Logical expression evaluation
by Enlil (Parson) on Jul 27, 2005 at 15:51 UTC | |
Re: Logical expression evaluation
by polettix (Vicar) on Jul 27, 2005 at 17:33 UTC | |
Re: Logical expression evaluation
by jolande (Initiate) on Jul 28, 2005 at 02:43 UTC | |
Re: Logical expression evaluation
by halley (Prior) on Jul 27, 2005 at 16:17 UTC | |
by ikegami (Patriarch) on Jul 27, 2005 at 16:26 UTC | |
by benizi (Hermit) on Jul 27, 2005 at 20:55 UTC | |
by bart (Canon) on Jul 27, 2005 at 21:07 UTC |