Thanks Everyone.
Borrowing from what you have suggested, really helped. I now know where I was screwing up at. How can I delete something when I have skipped it first? That was a good question and a wrong way to think. so thank for your help. If you want to see what the rewritten code looks like, here you go.
#!/usr/bin/perl -w
$dir = "(directory path)";
print "Starting Delete Process\n\n";
opendir(DIR, "$dir") || die "No $dir: $!";
@files = grep(!/^\./, readdir(DIR));
@files = sort @files;
closedir(DIR);
foreach (@files)
{
print $_, "\n";
if (/\.log$/i || /\.\d+\w+\-\d+\wm$/i || /\.txt$/i)
{
unlink ("$dir/$_") if (-f "$dir/$_") ||
print "Unable to delete $_: $!";
}
}
Basicly, this script will now delete any log file, date-time file, or text file found in a predetermined directory.
Thanks once again for your help.