in reply to Unlink doesn't work on first file

What does Perl tell you? Use the $! variable to report errors:

unlink $file or die "Cannot unlink '$file': $!\n";