SoFunction
Updated on 2025-04-07

Perl file test operator summary


-r: The file or directory is readable to this (effective user) or group
-w: File or directory is writable to this (valid) user or group
-x: The file or directory is executable for this (valid) user or group
-o: Files or directories are owned by this (valid) user
-R: The file or directory is readable to this user (real user) or group
-W: The file or directory is writable to this user or group
-X: The file or directory is executable to this user or group
-O: Files or directories are owned by this user
-e: The file or directory name exists
-z: The file exists, size is 0 (the directory always has false)
-s: The file or directory exists, with a size greater than 0 (value is the size of the file, unit: bytes)
-f: for normal text
-d: for directory
-l: for symbolic link
-S: for socket-p as pipeline (Entry is a named pipe(a"fifo"))
-b: is a block-special file (such as mounting disk)
-c: is a character-special file (such as I/O device)
-u: setuid file or directory
-g: setgid file or directory
-k:File or directory has the sticky bit set
-t: The file handle is TTY (the return result of the system function isatty(); this test cannot be used for file names)
-T: The file is somewhat like a "text" file
-B: The file is somewhat like a "binary" file
-M: Modified time (unit: day)
-A: Time of visit (unit: day)
-C: Indices node modification time (unit: days)