in reply to How to read from STDIN?

You may also want to do is look at the '-X' section of the perlfunc man page. These handy tests will help you tell the difference between files and directories & such. As an example, insert the following bit immediately after your # list files comment:

print "DIR: " if -d $file; print "FILE: " if -f $file;
--roboticus