in reply to dynamic regex

I don't understand which logic leads from 'Oct 10 05:59:59' to 'Oct 10 05:5[0-2]:'

but yes, you can put a datetime-string into a variable, dynamically manipulate this variable and use it as a pattern within any regex.

my $dt = 'Oct 10 05:59:59'; $dt =~ s/9:59$/[0-2]:/; $file =~ m/$dt/;

HTH!

Cheers Rolf