$ordner="Songs"; opendir(d,"$ordner") or do { print "$!"; exit; }; @files=grep {/\.mp3$/} readdir d or do { print "$!"; exit; }; closedir(d); $found=0; foreach $file (@files) { next if $file =~ m/unknown/i; next if $file =~ m/untitled/i; $orifile = $file; # backup $file =~ s/(_\d+)?\.mp3$//ig; # doppeltes ende weg $file =~ s/feat.*?-//ig; # "featuring..." entfernen $file =~ s/presents.*?-//ig; # "presents..." entfernen $file =~ s/and.*?-//ig; # "and..." entfernen $file =~ s/\bthe\b//ig; # "the" entfernen $file =~ s/(th|ht)/t/ig; # schreibfehler th/ht -> t $file = lc($file); # kleinschreiben $file =~ s/[^a-z]//ig; # alle sonderzeichen weg $total{$file}++; # zum hash addieren } foreach (sort keys %total) { if($total{$_}>1) { print $total{$_}."\t: ".$_."\n"; $found+=$total{$_}-1; } } print "Finished\n"; print "Found $found double files"; <>;