9.4.3. Discussion
A key in %seen is made by combining the device
number ($dev) and inode number
($ino) of each file. Files that are the same will
have the same device and inode numbers, so they will have the same
key.
If you want to maintain a list of all files of the same name, instead
of counting the number of times seen, save the name of the file in an
anonymous array.
foreach $filename (@files) {
($dev, $ino) = stat $filename;
push( @{ $seen{$dev,$ino} }, $filename);
}
foreach $devino (sort keys %seen) {
($dev, $ino) = split(/$;/o, $devino);
if (@{$seen{$devino}} > 1) {
# @{$seen{$devino}} is a list of filenames for the same file
}
}