in reply to Read a file into a hash

If you are dealing with a “well-known format,” such as (say...) a Windows .INI file or an OS/X plist, look for an existing CPAN module that is specific to that format.