in reply to regex and printing
Text::CSV_XS is enormously useful for reading and writing CSV (Character Separated Value) files. Maybe take a look at it and see if it can at least partially satisfy your needs.
Give a man a fish: <%-{-{-{-<