in reply to Comparing file properties

Hi

Not using File::Stat, and using the 'core' stat, may be one solution

use Modern::Perl; my @files = qw { ./adt1.pl ./adt2.pl }; my $color; my $cur_time = time; my @quake_times = qw( 21600 3600); say 'Current time: ', $cur_time; foreach my $a_filename(@files) { #stat() on the file name my $mtime = (stat($a_filename))[9]; say $a_filename, ", " , $mtime; if (($cur_time - $mtime) > $quake_times[1]) { $color = 'red'; } elsif (($cur_time - $mtime) > $quake_times[0]) { $color = 'yellow'; } else { $color = 'green'; } say ("color is ", $color, "\n"); }

The code above outputs:

~/perl/ex/perlmonks: perl ./adt5.pl Current time: 1372263479 ./adt1.pl, 1372261299 color is green ./adt2.pl, 1372262161 color is green

I hope this helps

Arnaud