#!/opt/local/bin/perl use strict; use warnings; use File::stat; # initialize my $element; my $filename; my $fh; my @files; my $sb; my @quake_times; my $color; my $cur_time = time; my $mtime; print ("current time is ", $cur_time, "\n" ); @quake_times = qw( 21600 3600); @files = qw( markers/quake markers/volcano satellites/NORAD.tle); my $directory = "/Users/coblem/xplanet/"; foreach $element (@files) { $filename = $directory . $element; open $fh, '<', $filename; #$sb = stat($fh); # scalar localtime $sb->mtime; $mtime = (stat($fh))[9]; print ($cur_time , " ", $mtime); if (($cur_time - $mtime) > @quake_times[1]) { $color = 'red'; } elsif (($cur_time - $mtime) > @quake_times[0]) { $color = 'yellow'; } else { $color = 'green'; } print ("color is ", $color, "\n"); }