http://www.perlmonks.org?node_id=873516


in reply to Text File Parsing

Data Dumper to visualize your data structures, Tutorials->References-> particularly the topics on hashes of arrays (HoAs), The split function and Text::Table to format your textual data are some of the things you can look into to get this job done...

The general steps involved can be as follow:

  1. loop through your data file.
  2. split each line into a key and a value.
  3. push into the HoA the values referenced by the key.
  4. Loop through your HoA to print the lines or use Text::Table to align table columns neatly
You may also need to deal with missing values and make sure that all your records are five-attributes long...


Excellence is an Endeavor of Persistence. A Year-Old Monk :D .