When i do this i tend to be more interested in what files match so do one of these two paths

#!/usr/bin/perl use warnings; use strict; use Data::Dumper; ############## my $md5files={}; my $filesmd5={}; while (my $line=<DATA>){ chomp $line; my ($fn,$md5)=split(' ',$line,2); push @{$md5files->{$md5}},$fn; $filesmd5->{$fn}=$md5; } # line for my $md5 (keys %$md5files){ my $md5list=$md5files->{$md5}; if (scalar(@$md5list) == 1 ) { print $md5."\n ".$md5list->[0]."\n" +;} else { print $md5."\n"; for my $file (sort @$md5list){ print ' '.$file."\n"; } } } # md5 for my $file (sort keys %$filesmd5) { my $md5list=$md5files->{$filesmd5->{$file}}; if (scalar(@$md5list) == 1 ) { print $file." is unique\n";} else { print $file." is the same as\n"; for my $filed (sort @$md5list){ print ' '.$filed."\n" unless ($file eq $filed); } } } # file exit; __DATA__ file2 d41d8cd98f00b204e9800998ecf8427e file1 5bb062356cddb5d2c0ef41eb2660cb06 file3 d41d8cd98f00b204e9800998ecf8427e file4 d41d8cd98f00b204e9800998ecf8427e file5 5bb062356cddb5d2c0ef41eb2660cb06 file6 d617c2deabd27ff86ca9825b2e7578d4
d617c2deabd27ff86ca9825b2e7578d4 file6 d41d8cd98f00b204e9800998ecf8427e file2 file3 file4 5bb062356cddb5d2c0ef41eb2660cb06 file1 file5 file1 is the same as file5 file2 is the same as file3 file4 file3 is the same as file2 file4 file4 is the same as file2 file3 file5 is the same as file1 file6 is unique


In reply to Re: List Duplicate Files in a given directory by huck
in thread List Duplicate Files in a given directory by pr33

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.