I was using ! operator today, and I notice a case where I expected a different output.
When I do !0, it results 1. But, when I do !1, it is neither returning 0 nor undef.
use 5.10.0; use strict; use warnings; my $r = !1; if (defined $r) { say "Defined"; } else { say "Not defined"; }
I don't understand, why it works this way. Help me to know what's happening in perl when I do this operation.
In reply to how ! operator works by nagalenoj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |