I just wanted to show an alternative. I think the solution you posted is the most useful for the specific question at hand. Perhaps the OP has some control over the format of the input data. What if they had the means to quickly obtain the input data in delimited format (e.g. a command line switch)? Then maybe using Text::xSV::Slurp makes sense. Also, the module has additional features that may prove useful for the OP in the future.