in reply to Deleting specified files and directories

The only small part you're missing is, that your files are not in the current directory but in $basedir/$mesgdir. Otherwise, your code seems fine, but using unlink $file or die "Couldn't delete $file : $!\n" is a method to catch your errors earlier :)

Another thing is, you seem not to be using strict;. This would not have helped in this case, but use strict; is a good habit to start with early.

  • Comment on Re: Deleting specified files and directories