Read in the dates and store into an array.
You can then use "sort" and end up with a list of
dates that look like:
@dates = sort @dates;
20020101
20021225
20040615
20050801
20050805
20050811
in this case the last date is the newest, but you could just as easily use "reverse" on the sort.
#-----------
use Date::Parse 'str2time';
my $time = str2time('8/12/2005');
#-----------
That will give you a 'time' value, i.e. a big number representing the number of seconds since 1 Jan 1970. So you could get the most recent date in a one-r like this:
#-----------
use Date::Parse 'str2time';
my $most_recent = (reverse sort {str2time($a) <=> str2time($b)} @dates)[0];
#-----------
which is arguably a bit cleaner than using two sprintf commands, at the (small) expense of loading the Date::Parse module.
Anyway just another option.
Ref [search.cpan.org...]