Created
May 23, 2013 05:34
-
-
Save mattak/5632946 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use 5.010; | |
use Text::CSV_XS; | |
use Log::Minimal; | |
use Path::Class; | |
my $csv = Text::CSV_XS->new({binary => 1}) or die 'cannot new Text::CSV_XS'; | |
my $from_stdin = ($#ARGV != 0); | |
my $io = ($from_stdin) ? *ARGV : file($ARGV[0])->openr; | |
while (my $row = $csv->getline($io)) { | |
my @fields = @$row; | |
say join("\t", @fields); | |
} | |
$csv->eof or $csv->error_diag(); | |
$io->close if ($from_stdin); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment