#!/usr/bin/perl -w use strict; use DateTime::Format::Strptime; my $strp = DateTime::Format::Strptime->new( pattern => "%Y-%m-%d", ); while( <> ) { chomp; my( $date, $value ) = split /,/, $_; my $dt = $strp->parse_datetime( $date ); printf "%d,%s\n", $dt->epoch, $value; }