$latest_date = shift @dates;
After that, you can use the code I posted to transform this from yyyymmdd to yyyy,mm,dd, like so:
$latest_date =~ s/([0-9]{4})([01][0-9])([0-3][0-9])/\1,\2,\3/;
Essentially what this does is groups together 4 numbers, 2 numbers, then 2 numbers, and inserts a comma between each group. Hope that clears things up a bit; if not, let me know :)
Chad
[3]
my $date = 20051004;
$date =~ s/(.{4})(.{2})(.{2})/\1,\2,\3/;
print $date;[/3]
although I think it is a good idea to check the format first. I would only do this if I knew for sure the dates were yyyymmdd formatted.