my $age = (stat $remote)[9]; my $cutoff = time - 86400 * 7; # now less 7 days if( $age < $cutoff ) { # file is older }