The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Text::CSV::Slurp - convert CSV into an array of hashes

SUMMARY

I often need to take a CSV file that has a header row and turn it into a perl data structure for further manipulation. This package does that in as few steps as possible.

USAGE

 use Text::CSV::Slurp;

 my $data = Text::CSV::Slurp->load(file       => $filename   [,%options]);
 my $data = Text::CSV::Slurp->load(filehandle => $filehandle [,%options]);
 my $data = Text::CSV::Slurp->load(string     => $string     [,%options]);

Returns an array of hashes. Any extra arguments are passed to Text::CSV. The first line of the CSV is assumed to be a header row. Its fields are used as the keys for each of the hashes.

METHODS

new

 my $slurp = Text::CSV::Slurp->new();

Instantiate an object.

load

  my $data = Text::CSV::Slurp->load(file => $filename);
  my $data = $slurp->load(file => $filename);

Load some CSV from a file, filehandle or string and return an array of hashes

DEPENDENCIES

Text::CSV

IO::Handle

Test::Most - for tests only

LICENCE

GNU General Public License v3

SOURCE

Available at http://code.google.com/p/perl-text-csv-slurp/

SEE ALSO

Text::CSV

Spreadsheet::Read