[Israel.pm] undef vs. ""

Chanan Berler chananb at centerity.com
Wed Jan 7 00:32:15 PST 2009

Hi All,

I wonder if I should consider "" equal to undef.
If it is so..then is there an empty string? Or there is not

Please consider this as an example:

print "undef" if ($" == undef);    ----> will print: undef
print "found \"\"" if ($" == "");  ----> will print: found ""

so I can understand that $" == "" == undef

So why do I get a warning message, when doing this:
$var = undef . "string";

But never get this warning message when doing:
$var = "string" . undef

Also I found that when trying to do this, no warning is out
$var = "" . "string";
$var = "string" . "";

PS: another thing I found, different warnings when using "use warnings;" - 

Is this a bug in perl, or just a fact? Or lets say a "known issue"

More information about the Perl mailing list