Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use Template;
- use Text::CSV;
- my $tt = Template->new();
- my $csv = Text::CSV->new({binary=>1});
- my $fh = open("<:encoding(utf8)", $ARGV[0]) or die("$ARGV[0]: $!");
- my $headers = $csv->getline($fh);
- # The above line give this error:
- # Can't locate object method "getline" via package "1" (perhaps you forgot to load "1"?) at ./notify.pl line 14.
- $csv->column_names(@{$headers});
- while (my $data = $csv->getline_hr($fh)) {
- my $output = $data->{id} . ".eml";
- $tt->process("template.tt2", $data, $output);
- }
- close $fh;
Add Comment
Please, Sign In to add comment