http://www.perlmonks.org?node_id=504598


in reply to How to Parse a Text into HoA

The problem is that you're declaring $fname in every iteration of the loop, so it's always undef by the time you're using it as a hash key. Move the declaration of $fname OUTSIDE the while loop and you'll be ok.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart