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

Replies are listed 'Best First'.
Re: Unlinking on NT
by knight (Friar) on Aug 25, 2000 at 20:48 UTC
    I've had to deal with NT file names a lot lately. I've had the most success escaping the entire file name with \Q...\E, which automatically quotes all pattern metacharacters (not just backslashes). This would turn your unlink line into something like:
    unlink "\Q$_\E" or die "\ncan't delete \Q$_\E\n";
    Without the $! error message, I can't say for sure this will fix your problem. If it does, my guess is that it would have to do with something trying to expand the '$' in the file names.

    Update:You'll especially want the \Q...\E around $_ in your die message so you can read the file names. Otherwise, the expansion in the double-quotes starts interpreting \b and \n and \r in the middle of your file name...
Re: Unlinking on NT
by tye (Sage) on Aug 25, 2000 at 20:29 UTC

    You need to include $! in your "die" message. (You can also include $^E during debugging since it occasionally offers an extra hint). Then tell us what error you are getting.

            - tye (but my friends call me "Tye")