Many things look simple, few things are simple. Take OP's "simple requirements" for example: "I'd like my program to read in some data at start, rather than hard-code it into the program". Ok, OP is talking about storing some configuration information and the sample data given indicates simple key:value data.
But how simple is that? The code given breaks in all sorts of ways - empty lines, lines without a colon, values containing colons, duplicate keys, nasty configuration file names (two param open rather than three), missing or otherwise unreadable configuration file and very likely other things as yet unthought of.
Ok, OP spends a little time up front trawling through CPAN (with a little guidance) and comes up with a tool kit for solving the problem today and, well golly, solving the problem again in a different context tomorrow. Sounds like well spent time to me, and there is still time left this afternoon for a beer.
Sure, at some point you have to write some code to solve your own specific problem, but the more glue and the less new code the more likely it is that you don't have to deal with all the edge cases and stuff you've not thought of. In this case half an hour research and five minutes coding is likely to save several hours down the track bodging up the holes in the first implementation - and they are likely to be hours with people breathing down your neck as you sort out problems with a live system. Saving those sort of hours is worth several up front hours any day!
In reply to Re^3: Converting a Flat-File to a Hash
by GrandFather
in thread Converting a Flat-File to a Hash
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |