This is strange. The following:
$sum = !0; print $sum;
prints out 1 as you would expect. But this
$sum = !1; print $sum; >
The operators that only return a boolean result will always return 1 for true and a special false value that's "" in string contexts but 0 in numeric contexts.