laziness, impatience, and hubris | |
PerlMonks |
Why Does the Hash Seem Empty?by o2bwise (Scribe) |
on Jul 20, 2007 at 19:06 UTC ( [id://627854]=perlquestion: print w/replies, xml ) | Need Help?? |
o2bwise has asked for the wisdom of the Perl Monks concerning the following question: Hi Monks, I have this application at work where I need to produce files, but where there is no desire to do so in the event the files would be empty. At a stage in the code, I have a hash. I check to see if the hash has at least one value. If it does, at the next portion of code, its contents are printed out to a file. The problem is, the program produced files of zero file size. In my investigation, I found that for such an occurrence, the hash actually had one key,value pair. However, when the code proceeded to print out the contents of the hash, there was nothing printed out! Can someone share with me why this is happening and how I can correctly identify the hash contains at least one key,value pair in such a way that I can next print out all of the contents of the hash? Here is the code before some added test snippets.
And here is the code with some checks, where I verified the hash had a key, value pair and whose contents did not print out in the second while loop.
Thanks much for any help, Tony
Back to
Seekers of Perl Wisdom
|
|