in reply to Modes in perlfunc

For more information on this, find yourself a Unix system and check out the sys/stat.h file (you may have to follow a chain of #includes on particularly strange OS's like Linux) but you're looking for a file that contains #defines like this:

#define __S_IFMT 0170000 /* These bits determine file type. */ /* File types. */ #define __S_IFDIR 0040000 /* Directory. */ #define __S_IFCHR 0020000 /* Character device. */ #define __S_IFBLK 0060000 /* Block device. */ #define __S_IFREG 0100000 /* Regular file. */ #define __S_IFIFO 0010000 /* FIFO. */
And so on. If you bitwise AND these definitions against that 6-digit octal number (st_mode), you'll see how the -X file tests work in Perl.