Since using a variable that you haven't assigned anything to is a core feature of Perl, I don't see how this could be avoided. I think you might have been tripped up by your knowledge of Perl here. A newbie would probably not expect those values to be in %hash before running the line that assigns them to it.