http://www.perlmonks.org?node_id=929897

ezekieldas has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to find files that are the same size in bytes. Some specific examples we're working with are: f.sst is 939, g-w0e.sst is 2031, f-f3i.sst is 939. So, I'm interested in the two files which equal 939. I want to print the file, it's size in bytes when there are two or more with matching bytes. To simplify, using this example:
@stuff = (a, 1, b, 2, c, 3, d, 3);
I'd like to see:
c => 3 d => 3
The closest I can get to this is...
@stuff = (a, 1, b, 2, c, 3, d, 3); push(@unique, foo, grep { $seen{$_}++ } @stuff); %unique = @unique; while ( ($key, $value) = each %unique) { print "$key => $value\n"; }