in reply to Unlinking...

I'm not quite sure exactly what you want to do, but if you want to delete all the text files in a directory you can do something like this.
#!/usr/bin/perl -w opendir(DIR, "../test") or die "Can't open ../test: $!"; my @f = readdir DIR; @f = map { unlink $_; $_ } grep { /\.txt$/i } @f;
or
my @f = <*.txt>; @f = map { unlink $_; $_ } grep { /\.txt$/i } @f;
Both of them return the deleted file names in the @f array.
Update: Or what arturo said above me!