in reply to if not defined question

Indeed, based on the code you show, you should not be able to get the warning you show without also getting your "no HOST defined ..." message. Now, there are (unlikely) ways I can imagine arranging that to happen: 1) have STDOUT going to /dev/null but not STDERR; 2) override printf() with something that changes $_[1]; etc.

My guess is that a more likely explanation is that this isn't the exact code that you are dealing with and your translation from the real code to this post omitted the real cause.

BTW, I disagree with most of the other replies offered so far. Autovivification doesn't explain your problem. I think using exists is a worse idea (only use exists when you have a separate useful meaning for "exists but not defined", which is almost never the case, and should almost never be the case), and suggesting that you change the flow just seems to be missing the point that you are trying to figure out how you got the warning in question.

- tye