#! /usr/bin/perl -w # Written by Alan De Smet, August 2012 http://www.highprogrammer.com/alan/data/inflation.html # Released into the public domain. This comes with no warranty of any sort, use # at your own risk. use strict; while(<>) { next unless /^ (19|20)\d\d /; my($dummy,$year, @data) = split(/\s+/); my $month = 0; foreach my $data (@data) { $month++; print "$year-$month-1,$data\n"; if($month >= 12) { last; } } }