Your script can be done much simpler if you generalize it.
use File::Copy; use File::Find; use strict; use warnings; ### Parse numerical characters and trailing white-space from rmtdb.lrl + for matching. copy("rmtdb.lrl" , "rmtdb.tmp") or die "rmtdb.lrl file cannot be copied: $!\n"; system "cat rmtdb.tmp | cut -d ' ' -f1 > rmtdb.tmp1"; my %lines; for my $file (qw(dblist.comdbg dblist.varldb rmtdb.tmp1)) { open my $fh, $file or die "Can't open $file: $!"; while (<$fh>) { chomp; # Special case of rmtdb $_ = lc $_ if $file eq 'rmtdb.tmp1'; $lines{$_}{$file}++; } close $fh; } foreach my $line (keys %lines) { my @files = sort keys %{$lines{$line}}); next if @files < 2; print "$line is duplicated in: " . join(' ', @files) . "\n"; } ### Cleanup unlink "rmtdb.tmp", "rmtdb.tmp1";
Then if you want to process 20 files, you can just add them to the loop
In reply to Re: Sting matching
by wind
in thread String matching
by jwesley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |