in reply to Re: Help tightening up a subroutine please
in thread Help tightening up a subroutine please
These may not always be true, but they autovivify an element so *will* be true the second time over you test them with the same key.
I don't think that's true.
my %x; print "one\n" if defined %{$x{a}}; print "two\n" if defined %{$x{a}}; print Dumper( \%x );
It does autovivify, but it does so to a value that's still not defined (when tested that way, anyway). Full output:
$VAR1 = { 'a' => {} };
UPDATE: I should add that I do not think this is a good way to do this check. It would be better to check that the key exists and then, if you need to know that there's something in there, dereference the array and check that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Help tightening up a subroutine please
by gaal (Parson) on Jan 23, 2007 at 22:06 UTC | |
|
Re^3: Help tightening up a subroutine please
by ikegami (Patriarch) on Jan 23, 2007 at 18:49 UTC |