in reply to Comparison Of Files

My boss wants me to create a tool that tells you which cellsite came up over night. So if someone clicks the button today (tuesday) they would get the sites that came up monday night through tuesday morning.
use Time::Local; my $sec = 0; my $min = 0; my $close = 17; ## 5:00 pm my $open = 9; ## 9:00 am my $spd = 24 * 60 * 60; my $yes = time - timelocal( $sec, $min, $close, (localtime( tim +e - $spd ))[ 3, 4, 5 ] ); my $morning = time - timelocal( $sec, $min, $open, (localtime)[ 3, +4, 5 ] ); my $dir = '/'; ## where the files reside( rem ending slash ) my @cellsites; opendir CELLSITES, $dir or die "opendir"; @cellsites = map{ $_->[0] } grep{ $_->[1] <= $yes && $_->[1] >= $morning } map{ [ $_, ( ( -M "$dir$_" ) * $spd ) ]} readdir CELLSITES; closedir CELLSITES; ## print @cellsites to a file ## or to screen, or something

Replies are listed 'Best First'.
(tye)Re1: Comparison Of Files
by tye (Sage) on Dec 06, 2000 at 05:32 UTC

    Nice first post. (: I liked the completely different approach and I liked the way you did it.

    I thought you might appreciate another alternative for the final part:

    @cellsites = grep { my $age= $spd * -M $dir.$_; $age <= $yes && $morning <= $age } readdir CELLSITES;
    which I think is a slight improvement. Keep up the good work.

            - tye (but my friends call me "Tye")