26047|9/26/02|js|XBRV|893 Ronson Road||San Francisco|CA|96666|Matt|666-650-5114|matt@somewhere.com|710464|1|9/27/02|9/27/02|warranty|Yes|
26048|9/26/02|js|BEVT|13 West Kennedy Blvd.||Yourtown|FL|33456|Christian Carusso|713-867-1515||Tel-14|1|||non warranty ``cross ref: 26048||
26049|9/26/02|js|Ultimate Products|1 South Sunset Drive||Tempe|AZ|83331|Mike Goose|700-676-6006|goose@nowhere.com|RS-502,CC-95|1 each|||S/N A145902||
####
Use of uninitialized value in numeric gt (>) at /usr/lib/perl5/5.6.1/Time/Local.pm line 91, line 1.
Use of uninitialized value in numeric lt (<) at /usr/lib/perl5/5.6.1/Time/Local.pm line 91, line 1.
Use of uninitialized value in numeric gt (>) at /usr/lib/perl5/5.6.1/Time/Local.pm line 92, line 1.
Use of uninitialized value in numeric lt (<) at /usr/lib/perl5/5.6.1/Time/Local.pm line 92, line 1.
Use of uninitialized value in join or string at /usr/lib/perl5/5.6.1/Time/Local.pm line 103, line 1.
Use of uninitialized value in join or string at /usr/lib/perl5/5.6.1/Time/Local.pm line 103, line 1.
Can't handle date (0, , , 7, 8, -1899) at ./convertdates.pl line 27
####
#!/usr/bin/perl -w
use strict;
use Time::Local;
my $in_file="default.db";
my $out_file="properdates.db";
my ($sec, $min, $hr)=0;
my @fmt_date='';
my @new='';
open (IN,"$in_file")||die "Sorry, but I can't open the file:$!";
open (OUT,">$out_file")||die "Sorry, but I can't append the file:$!";
while(){
chomp;
my @line=split(/\|/);
my @date=(split/\|/)[1,14,15];
foreach my $i (@date){
if ($i){
#my ($d, $m, $y)=split/\//, $date[$i];
my ($d, $m, $y)=split/\//, $i;
$y-=1900;
--$m;
my $epoch=timelocal($sec, $min, $hr, $d, $m, $y);
($fmt_date[$i])=strftime('%d-%b-%Y', localtime($epoch));
} #end if
} #end foreach
push @new, qq($line[0]|$fmt_date[0]|$line[2]|$line[3]|$line[4]|$line[5]|$line[6]|$line[7]|$line[8]|$line[9]|$line[10]|$line[11]|$line[12]|$line[13]|$fmt_date[1]|$fmt_date[2]|$line[16]|$line[17]|$line[18]);
push @new, "\n";
} #end while
print OUT "@new";
close IN;
close OUT;