I was writing up a bit more, but then noticed the number of posts that appeared. So just three quick notes:
- You have a CSV file, so rather than using substr with fixed-width columns, perhaps you should consider using Text::CSV. It will make you code more resilient and you'll spend less time thinking how to parse the file.
- Given you want to organize by an arbitrary number of dates by zip code, it seems like you should use a hash of hashes keyed on ZIP (as others have suggested) - see perllol for operational details.
- From the content of your files, it sounds like these are pulled from a database. Is there a reason you are using local files as an intermediary rather than DBI?