Perl's identifiers are case sensitive. %userHash is not the same as %userhash.
One of the first things I do in such situations is a global case-insensitive search for the identifier using my editor. As I iterate through the search results it's much easier for my eyes to spot when something changes than by just skimming through the code.
One thing that might have made it easier to spot would be following Schwern's Skimmable Code talk's advice. Moving some of the complexity in your while/if constructs into subroutines would move the usage of %userhash visually closer to its declaration, which might be a good thing.