use 5.010; use strict; my $modified_within = 60 * 5; # 5 minutes my $size_limit = 1024 * 1024 * 2; # 2 MB my $file = "/some/file/name"; if ([stat $file]->[9] > time - $modified_within) { if (-s $file > $size_limit) { say "File is recent, and over size limit"; } else { say "File is recent, but not over size limit"; } } else { say "File is not recent"; }