in reply to Build a list of files that are NOT in a list

In a big directory, it's easy to miss that a malformed filename has slipped in. Were this my code, I'd be more defensive about
$pic =~ s/^(\d+).*/$1/; $h++; $uniquelist{$pic}++; next if ($currentlist{$pic}); $deletelist{$pic}++;
and would test whether the regexp actually matched before doing the bookkeeping.