I am using File::Find to search for any duplicate files on a volume of a certain size with the same MD5 sig. I want to track each duplicate file in my hash, and I want to keep the path info for each duplicate in my annonymous array. Using my code above, the correct info gets put into the array and I can even print it out doing this:if (-f) { my $fsize = stat($_)->size; if ($fsize > MINFILESIZE) { open(MD5FILE, "$_") || warn "Can't open file ($_): ($!)\n" +; binmode(MD5FILE); my $md5hash = Digest::MD5->new->addfile(*MD5FILE)->hexdige +st; close(MD5FILE); if (exists($fileInfo{$md5hash})) { $fileInfo{$md5hash}{path}[$fileInfo{$md5hash}{count}] += $File::Find::dir; $fileInfo{$md5hash}{count} += 1; } else { $fileInfo{$md5hash}{filename} = $_; $fileInfo{$md5hash}{size} = $fsize; $fileInfo{$md5hash}{count} = 1; $fileInfo{$md5hash}{path}[0] = $File::Find::dir; } } $totalFiles++; } }
This would produce something like:print "$fileinfo{$md5hash}{path}[0]\n"; print "$fileinfo{$md5hash}{path}[1]\n"; print "$fileinfo{$md5hash}{path}[2]\n";
But that assumes I know how many elements are in the array. My question is how do I iterate over the anonymous array?/home/djw/foo /home/djw/foo/bar /home/djw/foobar
In reply to How to reference a nested anonymous array by djw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |