Hi,

I want to write a script whose input data would be a csv file and records
would be as follows:-

60020003076570*,2,*20-SEP-08.01:09:18,,*04-NOV-08*
,10000,INR,,VOUCHER_BATCH_20080919_00014,2C,,0
30000000026495*,5,*20-SEP-08.01:09:57,,*31-DEC-09*
,100000,INR,,VOUCHER_BATCH_20080919_00024,1K,,0
30000000027480,*2,*20-SEP-08.01:09:57,,*31-DEC-08*
,100000,INR,,VOUCHER_BATCH_20080919_00024,1K,,0

Here I want to compare whether the 5th field, which is the date field
is *earlier
than 31-Mar-09 and 2nd field value is 2.*

If yes, then I will take that record and store it in another file.

Please help me as to how do I compare dates, preferably with some sample
code.

I started coding for this as below, but am stuck on how to compare date in
my input with another date.

#!/usr/bin/perl
use strict;
use warnings ;

open (my $IN_FILE,"<","testdata.txt") or die $!." file not found" ;
while (my $line=readline($IN_FILE))
{
        my @cdr=split (/,/, $line) ;
        if($cdr[5]
        .............
        .............
}

Thanks,
Mihir

Reply via email to