in reply to Parsing a Hash
username => $usename,
I don't know if this could be your problem but it looks like $usename might be a typo for $username. If you are not already doing so, put use strict; and use warnings; at the top of your scripts. They can help catch typos such as the above line might be.
I hope this is helpful.
Cheers,
JohnGG
In Section
Seekers of Perl Wisdom