in reply to Re: Example using CGI::Application::Plugin::Output::XSV
in thread Example using CGI::Application::Plugin::Output::XSV
You don't need the map. AOH is supported:
#!/usr/bin/perl use warnings; use strict; use Text::CSV_XS qw( csv ); my @header = qw( first_name last_name phone ); csv (in => [{ first_name => "Jane", last_name => "Rizzoli", phone => "555-1212" }, { first_name => "Maura", last_name => "Isles", phone => "555-1515" }, ], headers => \@header, );
Or if you have the hash list already.
my @header = qw( first_name last_name phone ); my @aoh = ( { first_name => "Jane", last_name => "Rizzoli", phone => "555-1212" }, { first_name => "Maura", last_name => "Isles", phone => "555-1515" }, ); csv (in => \@aoh, headers => \@header);
|
|---|