in reply to File Stricture Help

Your basic problem is in the delfiles routine: the unlink function takes a path name (or a list of path names) not a file handle:
sub delfiles { my $count = unlink @files; print "number of files deleted: $count\n"; }
or you could just delete them one at a time using a loop:
sub delfiles { for my $path (@files) { unlink $file; } }
which allows you to do something special if the file can't be deleted.

There are other issues with your script, but since this smells like a homework problem, it's probably best if you first attempt to figure those out on your own.

Replies are listed 'Best First'.
Re^2: File Stricture Help
by MrFloydFreak42 (Novice) on May 14, 2008 at 02:49 UTC
    Thanks alot, I didn't realize that.