in reply to how ! operator works
An empty string qualifies as "false" too. perlop tells us that ! provides logical negation, which is different from 'numeric.'
perlsyn tells us the following:
The number 0, the strings '0' and '' , the empty list () , and undef are all false in a boolean context. All other values are true. Negation of a true value by ! or not returns a special false value. When evaluated as a string it is treated as '' , but as a number, it is treated as 0.
Dave
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: how ! operator works
by moritz (Cardinal) on Feb 04, 2011 at 08:51 UTC | |
by arkturuz (Curate) on Feb 04, 2011 at 09:12 UTC | |
by bart (Canon) on Feb 04, 2011 at 14:20 UTC | |
by ikegami (Patriarch) on Feb 04, 2011 at 20:48 UTC | |
by arkturuz (Curate) on Feb 04, 2011 at 22:23 UTC | |
by ikegami (Patriarch) on Feb 04, 2011 at 23:32 UTC | |
by moritz (Cardinal) on Feb 04, 2011 at 09:44 UTC | |
by !1 (Hermit) on Feb 04, 2011 at 18:53 UTC |
In Section
Seekers of Perl Wisdom