Perl File Test Operators

Example True if file named in $a
-r $a is readable by effective uid/gid
-w $a is writable effective uid/gid
-x $a is executable effective uid/gid
-o $a is owned effective uid/gid
-R $a is readable by real uid/gid
-W $a is writable real uid/gid
-X $a is executable real uid/gid
-O $a is owned real uid/gid
-e $a exists
-z $a has zero size
-s $a has non-zero size
-b $a is a block special
-c $a is a character special
-d $a is a directory
-f $a is a plain file
-p $a is a named pipe (fifo)
-S $a is a socket
-l $a is a symbolic link
-t $a is a opened to a tty
-T $a is a text file
-B $a is a binary file
-u $a has setuid bit set
-g $a has setgid bit set
-k $a has sticky bit set
-M $a Age of file (at startup) in
days since modification (floating)
-A $a Age of file (at startup) in
days since last access (floating)
-C $a Age of file (at startup) in
days since inode change(floating)
Age, stored in $^T, can be negative
if file changed after script started.

Examples:
-e "/usr/bin/perl" or warn "Perl is improperly installed\n";
-f "/vmunix" and print "Congrats, we seem to be running BSD Unix\n";

Note: The underscore in the following test:
print "Can do.\n if -r $a || -w _ || -x _;
Uses the stat structure of the previous file test (or stat operator), thereby saving a system call. (Does not work with -t, and remember that lstat and -l leave values in the stat structure for the symbolic link, not the real file).