in reply to -z and directories

Try the following for a directory 'dirname":
use strict; my $s = (-s 'dirname'); print "s is $s\n";
On Linux it returns the directory size, 512. On Windows it returns 0. I have cygwin on Windows NT and it shows 0 as the directory size when I say "ls -ld dirname". It must be a difference in file system implementation. The "-z" test simply tells you whether "-s" returns 0 or not, so it's reasonable.