in reply to -f not identifying .txt files
As others have said, the problem is probably that you don't have the full path name in your -f argument.
I like to use Path::Class because it avoids these problems:
use Path::Class qw(dir); my $dir = dir("/path/to/dir"); my @files = $dir->children; my $examplefile = $files[0] or die "no files"; print "is plain file" if -f $examplefile; # Or: print "is plain file" unless $examplefile->is_dir;
In Section
Seekers of Perl Wisdom