in reply to Dynamically map the elements of CSV

Tie::Handle::CSV makes it all automatic: it reads the header line and makes the hash for you.

From the docs:

Tie::Handle::CSV makes basic access to CSV files easier. When you read from the file handle, a hash reference or an array reference is returned depending on whether headers exist or do not.
Regardless of the type of the returned data, when it is converted to a string, it automatically converts back to CSV format.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

  • Comment on Re: Dynamically map the elements of CSV