I don't understand how can it be at the same time defined, == 0, and eq "".
This is easy. The return value is the empty string !1† as bart says.
$ perl -le 'print "yes" if defined ""' yes $ perl -le 'print "yes" if 0 == ""' yes $ perl -le 'print "yes" if "" eq ""' yes
The bigger question you are asking—basically, why the empty string is returned—doesn't seem to have such a clear answer. This has come up recently in the discussion that followed Re^4: Unhappy returns. You'll find a closer look at the more general issue including how other statements are handled there. FWIW, I think it should probably be considered a bug. I'm pretty sure it isn't documented.
Which is exactly the same as the empty string only, uh, different It doesn't cause warnings where an empty string would.
Edit: Corrected "empty string" to !1 per bart's response below and added footnote.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: "last expression" quiz
by sauoq
in thread "last expression" quiz
by fxn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |