#!/usr/local/bin/perl -w use strict; use vars qw($opt_m); use Getopt::Std; my ($today) = &finder(); if ($script_mode eq 'normal') { my ($yesterday) = &read_benchmark(); &write_benchmark(); &print_report(); } else { &write_benchmark(); } sub finder { my %today; open (IN, "< todays data") or die "$!"; while () { chomp; $today{$_}++; } close (IN); return \%today; } sub read_benchmark { my %yesterday; open (BENCH, "< benchmark.txt") or die "$!"; while () { chomp; $yesterday{$_}++; } close (BENCH); return \%yesterday; } sub write_benchmark { open (BENCH, "> benchmark.txt") or die "$!"; foreach (sort keys %$today) { print BENCH "$_\n"; } close (BENCH); chmod(0640, "benchmark.txt") or die "$!"; return; } sub print_report { foreach (sort keys %$today) { print LOG "$_\n" unless exists $yesterday->{$_}; } foreach (sort keys %$yesterday) { print LOG "$_\n" unless exists $today->{$_}; } print LOG "End of Report.\n"; return; }