raybies has asked for the wisdom of the Perl Monks concerning the following question:
I allocated a hash, but didn't define any elements, and wanted to see if I had any elements in it. So I did...
and this yielded a warning saying this was deprecated. So Is the "acceptable" way to see if there's any elements in my hash just to do:my %hash; ... #check to see if anything's in my hash... if (defined %hash) ...
It works fine. And it doesn't yield a warning. Just was curious... --Raymy %hash; ... #check to see if anything's in my hash... if (%hash) ...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: if (defined %hash) deprecated
by Athanasius (Archbishop) on Oct 15, 2012 at 16:08 UTC | |
Re: if (defined %hash) deprecated
by Rudolf (Pilgrim) on Oct 15, 2012 at 16:13 UTC | |
by AnomalousMonk (Archbishop) on Oct 15, 2012 at 19:02 UTC | |
by Ralesk (Pilgrim) on Oct 16, 2012 at 08:12 UTC |
Back to
Seekers of Perl Wisdom