Well, I'll give this problem a go even though it has been beaten to death already. It's a bit long, but it works all the same.
use strict;
my %files;
my @files;
@files =<DATA>;
@files = map { s/\n//; $_ } @files;
close(DATA);
foreach (@files) {
$files{substr($_,0,(length()-4))}++;
}
foreach (keys %files) {
print "$_ is not matched and has a count of $files{$_}\n" if $file
+s{$_} == 1;
}
__DATA__
001.did
001.mrg
002.did
002.mrg
003.did
004.did
005.did
005.mrg
The output of this is:
C:\configs>perl test.pl
003 is not matched and has a count of 1
004 is not matched and has a count of 1
Of course, this code is nothing more than a modified "seen" loop. Not too fancy. One thing I should point out is that if you use
foreach (<*.mrg>), it'll do the same thing as your glob (because it is the same thing as far as I know). It's just shorter. Hope that sparks a few ideas.
Theodore Charles III
Network Administrator
Los Angeles Senior High
email->secon_kun@hotmail.com
perl -e "map{print++$_}split//,Mdbnr;"