Home: Perl Programming Help: Intermediate:
910614 - what does -M mean?



hamidi
Novice

Sep 4, 2012, 3:53 AM


Views: 4155
910614 - what does -M mean?

and may be used before what kind of variables (variables of what kind of values, int, string, etc.)?
it must be similar to -f, right?


rovf
Veteran

Sep 4, 2012, 5:58 AM


Views: 4152
Re: [hamidi] 910614 - what does -M mean?

This information is a bit hidden in the docs. Have a look at

perldoc perlfunc

and grep for

-X


Laurent_R
Veteran / Moderator

Sep 4, 2012, 10:48 AM


Views: 4136
Re: [hamidi] 910614 - what does -M mean?

In which context?

In a Boolean context before a file name, it returns the file last modification time. At the command line, it does import a module.


hamidi
Novice

Sep 4, 2012, 8:19 PM


Views: 4122
Re: [Laurent_R] 910614 - what does -M mean?

thx 4 replying
i found it at perlfunc. as i examined it, it doesn't return the last modification time of the file. if so, it should be the same as what Windows shows in the properties dialog of the file as the last modification time. i found that it's the same as "$^T-the last modification time of the file". then when i multiply it to 24*60*60 this value changes to number of seconds between the last modification time of the file and when the script has begun running.
correct me if i'm wrong.
thx


rovf
Veteran

Sep 5, 2012, 1:23 AM


Views: 4114
Re: [Laurent_R] 910614 - what does -M mean?


Quote
before a file name, it returns the file last modification time.


From the perldocs:

-M Script start time minus file modification time, in days.


Laurent_R
Veteran / Moderator

Sep 5, 2012, 10:27 AM


Views: 4078
Re: [rovf] 910614 - what does -M mean?

Yeah, right, I typed too fast, I meant the time elapsed (in days) between the last time the file was modified and the time the script was started.