AoH is the Array (lines) of Hashes (fields).
Your Mother's answer below is very sound advice. If you have more than one script / template, time invested in learning a framework will pay back great. If you want to try that, I'd recomend strongly that you check out catalyst. The new book they advertise is very good (I've read it) if you like a stepwise and practical introduction. Otherwise they have lots of online tutorials and documentation if you prefer that.
If you don't want to go that route yet, try factor out the parsing of the csv data (take a look at Text::CSV_XS and DBD::CSV. The latter of these will make your csv file feel like a database, simplifying searching and paging. Also, pull together one coherent template by extracting the print statements from the code.