Greetings.
I have a script that is generating a report in html using data from a flat-file pipe de-limited database where each entry is on a separate line. The report is comparing the most current entry with the last entry from the previous week. I am using the code below to compare the dates of the most recent entry with each previous entry until a different date is found.
open (DATABASE, "$filename" || &ErrorMessage);
@entry = <DATABASE>; #Assign DB entrie
+s to array
close(DATABASE);
@CurrentData = split(/\|/, $entry[$lines - 1]); #Assign last line
+ of data to array
@PreviousData = split(/\|/, $entry[$lines - 1]);
$count = $lines - 1;
#Find previous we
+eks data by comparing dates
while (($PreviousData[1] eq $CurrentData[1]) && ($count >= 0)) {
$count -= 1;
@PreviousData = split(/\|/, $entry[$count]);
}
This works as long as the dates are in the same month. If the dates are in different months the script will not display the most recent entry. Can anyone see what I'm doing wrong here? Is there a better/more effecient way of doing this?
Thanks for your time.