#!/usr/bin/perl while(<>) { chomp; split(/ /); if(/\#/) { $Year = $_[1]; $Month = $_[2]; } else { $Date = $_[0]; $Walk = $_[1]; $Weight = $_[2] * 0.1; $Datestring = "$Year-$Month-$Date"; $Jdate = `date -d $Datestring +%j`; # Day of Year $Days = ($Year - 1998) * 365 + $Jdate; print "$Days\t$Weight\t$Walk\t$Year\t$Month\t$Date\n"; } }