Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a simple code like below but the results do not make sense. Perhaps, I am doing something wrong:
#!/usr/bin/perl use strict; use warnings; my ($A, $B) = ""; $A = 0b0; $B = 0b0; my $z = (~$A & ~$B); print "Z: "; printf "%b\n", $z; print "Z: "; printf "%d\n", $z;
Z: 1111111111111111111111111111111111111111111111111111111111111111 Z: -1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Boolean calculation incorrect values
by Athanasius (Archbishop) on Dec 24, 2015 at 08:05 UTC | |
by GrandFather (Saint) on Dec 24, 2015 at 08:28 UTC | |
by Athanasius (Archbishop) on Dec 24, 2015 at 08:58 UTC | |
|
Re: Boolean calculation incorrect values
by GrandFather (Saint) on Dec 24, 2015 at 08:10 UTC |