|Don't ask to ask, just ask|
All I can say is that why did I spend the past 2 days trying to figure it out myself??!! I should come here earlier.
No, what you did is correct, you have to try out something of yourself first, otherwise you wouldn't have had the taste of regular expressions in that process.
moreover IMO, pack/unpack are not easier ones to understand and use for any Perl newbies!.
Good that you have got your solution, but never forget to try yourself and then come here for clarifications; we love to clarify such doubts.
-- 'I' am not the body, 'I' am the 'soul', which has no beginning or no end, no attachment or no aversion, nothing to attain or lose.
In reply to Re^3: How to read data file into an array of hashes