in reply to How to write better code?

I agree with all the other comments. Just one note on using Data::Dumper. If you pass it a reference, you'll get more readable output. Your code produces:
$VAR1 = 'name'; $VAR2 = 'alex'; $VAR3 = 'age'; $VAR4 = '20'; $VAR5 = 'sex'; $VAR6 = 'm';
If you just passed Dumper() a reference, like this:
print Dumper \%hash_init;
You'll get this:
$VAR1 = { 'name' => 'alex', 'age' => '20', 'sex' => 'm' };
Which is a whole lot nicer to look at.