in reply to Re: Predeclaration
in thread Predeclaration
Is anyone else surprised by the results?People who read the manual pages will not be surprised. From the manual page about defined:
Use of "defined" on aggregates (hashes and arrays)
is deprecated. It used to report whether memory
for that aggregate has ever been allocated. This
behavior may disappear in future versions of Perl.
You should instead use a simple test for size:
if (@an_array) { print "has array elements\n" }
if (%a_hash) { print "has hash members\n" }
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Predeclaration
by flounder99 (Friar) on Jul 16, 2002 at 17:39 UTC |