Why does defined() return true on empty arrays and hashes?

The short story is that you should probably only use defined on scalars or functions, not on aggregates (arrays and hashes). See perlfunc/defined in the 5.004 release or later of Perl for more detail.


Back to perlfaq4