my $filename = "050927104522.log"; use Date::Calc qw/Add_Delta_DHMS Today_and_Now Delta_YMDHMS/; my @thirtyMinAgo = Add_Delta_DHMS(Today_and_Now, 0,0,-30,0); # (Y,M,D,H,M,S) if($filename =~ /(\d{12})\.log/ ){ my @fileDateTime = $1 =~ m/\d\d/g; # Break into the (Y,M,D,H,M,S) format $fileDateTime[0] += 2000; # convert from YY to YYYY if( Delta_YMDHMS(@fileDateTime, @thirtyMinAgo) >= 0 ){ # fileDateTime is on or before thirtyMinAgo } }