非原创,来自链接
https://perlmaven.com/file-test-operators
Perl has a bunch of strange-looking unary operators that all look like this -X. They can act on any file or directory name or any file or directory handle.
They return various information about the specific file or directory.
Most of them return true or false and normally you would write something like this:
my $filename = "bla/bla/bla.txt"; if (-e $filename) { print "The file '$filename' exists\n"; }
-s returns the size of the file so you could write:
my $size = -s $filename;
The -M, -A, -C return the modification, access and inode change dates on Unix/Linux like systems. On Windows, I think only -M is available. In any case they work in a very str