1. Die "Oops! A file named '$ filename' already existed! "
If-e $ filename
Use the-E Option to check whether the file exists before the system creates a file.
2. Warn "config file is looking pretty old! /N"
If-M config> 28; # config is a file handle
Use the-M option to check whether a file has not been modified for a long time...
3. If-S $ FILENAME> 100_100 and-A $ FILENAME> 90; the file is larger than kb and is not accessed for 90 days.
4. UNIX file systems include the following types:-F,-D,-l,-S,-P,-B, and-C, any one must belong to one of them.
5. my ($ Dev, $ ino, $ mode, $ nlink, $ uid, $ GID, $ rdev, $ size, $ atime, $ mtime, $ ctime, $ blksize, $ blockes)
= Stat ($ filename );
These names indicate the meaning of the value returned by stat.
$ Dev and $ ino
The device Number of the file and the index node number. They constitute the file license plate. Even if it has multiple names (hard link), set
The combination of the preparation and index node numbers is still unique .)
$ Mode
File Permission bits and some other bits, such as 0755.
$ Nlink
Number of (hard) connections to a file or directory. It refers to the number of real names of the items to be detected. The directory value is always 2 or larger, and for a file (usually)
Is 1.
$ UID and $ GID
The user ID and group ID of the file ownership.
$ Size
Returns the size. Unit: bytes. The same as-s file detection items.
$ Atime, $ mtime, and $ ctime
These three time periods are in the system time format: 32 bits, indicating the number of seconds that have elapsed since a certain time point. This time point is one of the records of the system time.
Any value. In UNIX and some other systems, this time period starts from the first midnight on 1970, world time, but in some systems, this time period can be
Can be different.
6. My $ timestamp = 1180630098;
My $ date = localtime $ timestamp; # This way you can switch to a readable mode "The May 31 09:48:18 2007"
In the context of the list, localtime returns a column value.
My ($ sec, $ min, $ hour, $ day, $ Mon, $ year, $ wday, $ yday, $ isdst)
= Localtime $ timestamp;
$ Mon Is a number indicating the month, ranging from 0 to 11.
It is convenient to use it as the index value in the array of the month name. $ year refers to the number of copies per year from 1900. Therefore, you need to add 1900 to obtain the actual number of years. the value of $ wday ranges from 0 (Sunday) to 6 (Saturday ). $ yday indicates the number of days in a year, from 0 (January 1, January 1) to 364 or 365 (January 1, December 31 ).
File Check options and their meanings
Meaning of detection options
-R files or directories are readable for (valid) users or groups.
-W files or directories are writable to this (valid) user or group.
-X files or directories can be executed by (valid) users or groups.
-O files or directories are owned by (valid) users.
-R files or directories are readable to this user (real user) or group
-W files or directories are writable to this user or group.
-X files or directories are executable to this user or group.
-O files or directories owned by the current user
-E file or directory name exists
-The Z file exists and the size is 0 (the directory constant is false)
-S file or directory exists, the size is greater than 0 (value: file size, unit: bytes)
-F is a common text
-D is the Directory
-L is the symbolic link.
-S is socket
-P is the pipe (entry is a named pipe (a "" FIFO ))
-B is a block-special file (such as attaching a disk)
-C is a character-special file (such as an 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 result returned by the system function isatty (); this test cannot be used for file names)
-T files are somewhat like "text" files.
-File B is somewhat like a binary file.
-M modification time (unit: Day)
-A access time (unit: Day)
-C Index node modification time (unit: Day)