in reply to Comparing time and date stamps

I'll suggest a couple possibilities:

1. Embed the results of time() into the file name. It's an integer, so comparisons are simplified.

2. Use the age function and let it decide how old your files are:

# # the 'magic' of -x functions in Perl # -s gives size of $file in bytes, -M gives age in days. # my $size =-s $_; my $age =-M $_; $size /= 1048576.0; $total += $size;