thor has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/perl/bin/perl -w use strict; my %hash; my $cal = shift; read_cal($cal, 0); foreach my $file (@ARGV) { read_cal($file, 1); } foreach my $key (sort keys %hash) { print "$key\n" if $hash{$key} == 1; } sub read_cal { my $cal = shift; my $fh; print "---------------$cal-----------------\n"; my $mode; open($fh, $cal) or die; while(<$fh>) { chomp; s/\s//g; next if /^#/; next if /^\s*$/; next if $_ eq ""; if (/^I/) { read_cal(substr($_,1), $mode); } print "|$_|\n"; my $schedule = ((split(':'))[-1]); if (!$mode || exists($hash{$schedule}) ) { $hash{$schedule}++; } } }
thanks in advance,
thor
|
|---|