in reply to Trying to make the code more clear and clean
LanX has pointed out that what is shown in the OP is almost JSON. It would be useful to know exactly what the format of the input data file is. Is it in fact almost-JSON? Is it something that could easily be converted to strict JSON? Is it something that could easily be converted to a Perl expression string and fed to eval (Perl is more forgiving of some things than JSON)? A more simple and/or elegant solution might emerge from more detail.
Update: Some wording changes/enhancements.
Give a man a fish: <%-{-{-{-<
|
|---|