What if get two paired variables, and want to check that both are initialized, or both are empty or null strings?
I don't necessarily want it to act like anything (0 or empty string) -- I just want it to compare as "not equal" to something that is defined, or "equal" to something that isn't -- with the caveat, that undef == undef, is only equal in a certain context -- i.e. they are both uninitialized.
I would want it to compare different if I compared undef against 0 or the empty string, so assigning either of those
other values would miss the point entirely.
That middle case isn't sufficient on rather old versions of Perl because it used to be that length(undef) was '0' with a warning. Now length(undef) is undef so you'll only get the warning if you treat the length as a number.
Some people replace '!' with '!!' because they use '!!' as an idiom for "I just care about whether it is true or not" or "convert to Boolean".
But I find it way too easy to end up making mistakes when you start using the ultra-low-precendence Boolean operators for things other than flow control (I've found quite a few such mistakes made by some of the most experienced Perl programmers I've worked with), so I don't really like that approach. (I also don't like 'unless' but I won't go into that here.) ]