nagalenoj has asked for the wisdom of the Perl Monks concerning the following question:
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.
Back to
Seekers of Perl Wisdom