Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use Text::CSV;
- use strict;
- use warnings;
- my $csv = Text::CSV->new ( { binary => 1, eol => "\n" } )
- or die "Cannot use CSV: ".Text::CSV->error_diag ();
- open my $fh, ">", "test.csv" or die "test.csv: $!";
- my @rows = (
- ['A1', 'B1', 'C1'],
- ['A2', 'B2', 'C2'],
- ['A3', 'B3', 'C3'],
- ['A4', 'B4', 'C4'],
- );
- $csv->print($fh, $_) for @rows;
- close $fh;
Advertisement