Using defined() on aggregate types is a big mistake. So stop that. The important thing is that @x is empty. Whether @x is defined doesn't mean anything interesting at all (I don't even remember what it means because it isn't something I want to use).
The difference cropped up for me when getting back data from grep, which returns undef when nothing in the input list matches the criteria of the code block.
No, grep in a scalar context returns a "false" value which might be undef (though I doubt it). In a list context, grep returns an empty list. If you do @x= grep ..., then whether or not @x is defined when you are done is not something you should ever check or care about.
- tye (but my friends call me "Tye")In reply to (tye)RE: What Data::Dumper dumps is not necessarily what is there
by tye
in thread What Data::Dumper dumps is not necessarily what is there
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |