What is this flag?
if (-M ..filepath..)
what is the '-M' flag?
In Perl, if statements are the conditional statements that work on either or statements, i.e. it executes the program or task based on the condition that can be true or false.
Everything else is true. If you do not remember the rules or you doubt whether a condition is true or false, you can always write a simple if statement to test if the expression. The limitation of the Perl if statement is that it allows you to execute a single statement only.
If you do not remember the rules or you doubt whether a condition is true or false, you can always write a simple if statement to test if the expression. The limitation of the Perl if statement is that it allows you to execute a single statement only. If you want to execute multiple statements based on a condition, you use the following form:
The limitation of the Perl if statement is that it allows you to execute a single statement only. If you want to execute multiple statements based on a condition, you use the following form: if (expression) { statement; statement; ... } Noticed that the curly braces {} are required even if you have a single statement to execute.
perldoc -f -M
will answer your question...
This is the modification "age" of the file, in fractional days. That is, it is the number of days since the file was modified, as of the script start time (or as of some other time, if you explicitly set the $^T
variable).
I sure hope that the actual code is along the lines of -M filepath > ...; just testing -M's result for truth is pointless.
Script start time minus file modification time (aka file modification age), in days.
In other words, it returns the age of OPERAND in days when the program started.
Also see a full list of file test operators in perldoc perlfunc (-X section)
Modification age (measured in days)
from http://www.devshed.com/c/a/Perl/File-Tests-in-Perl/
if we have something like this:
$age = -M FILE;
$age
will contain the days since the file was modified.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With