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.
In reply to Re: Deleting specified files and directories
by Corion
in thread Deleting specified files and directories
by Sadmachine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |