#!/usr/bin/perl use strict; use Text::CSV; use Tie::File; my (@records, @removed); tie @records, 'Tie::File', "test.csv"; @removed = splice(@records,0,2); print join ("\n", @records); untie @records; my $file = 'test.csv'; my $csv = Text::CSV->new(); open (CSV, "<", $file) or die $!; open (MYFILE, '>>convertedDate.csv'); #Column Headers #First 2 are in Epoch time print MYFILE "Arrival, Modified Date, Severity, Status, TicketID, Message\n"; close (MYFILE); while () { if ($csv->parse($_)) { open (MYFILE, '>>convertedDate.csv'); my @columns = $csv->fields(); #I know this next line isn't so elegant print MYFILE scalar(localtime(@columns[0])) . "," . scalar(localtime(@columns[1])) . ",\"" . @columns[2] . "\",\"" . @columns[3] . "\",\"" . @columns[4] . "\",\"" . @columns[5] . "\""; print MYFILE "\n"; close (MYFILE); } else { my $err = $csv->error_input; print "Failed to parse line: $err"; } } close CSV;