In the first case () is in scalar context so is a pair of empty brackets, not the empty list you may have been expecting. There is no error because => is really just a comma that implictly quotes the bare word to the left. The anon hash is thus the equivelent of {'foo', }. (See List value constructors and Comma Operator.)
Why you get different behaviour in the debugger I don't know however.
Update: strike bogus scalar context comment - see reply.
In reply to Re: warnings under the debugger
by GrandFather
in thread warnings under the debugger
by trwww
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |