Hi,
I'm trying to extract dates (from flat file) which are in the following format: yyyy-mm-dd and then split the field to create an array... Here's a simplified version (no flat file) You will notice that only extract 3 dates out of 4 are extracted.
Thank you in advanced
I'm trying to extract dates (from flat file) which are in the following format: yyyy-mm-dd and then split the field to create an array... Here's a simplified version (no flat file) You will notice that only extract 3 dates out of 4 are extracted.
Thank you in advanced
Code:
while(<DATA>) {
my @Data=<DATA>;
foreach my $record (@Data) {
chop $record;
# Split fields
my @field=split(/\|/,$record);
my @field_date=split(/\-/,$field[4]); # Date in field
my @current_date = ($year, $month, $day); # Current date using localtime
print "Field Date: @field_date <br> \n";
}
}
__DATA__
12|data|data|data|2004-06-01
13|data|data|data|2004-05-31
17|data|data|data|
14|data|data|data|2003-05-23
15|data|data|data|2002-02-12