in reply to Getting a file's timestamp and storing this as a variable

-M is just a weirdly named function, really.

if (-M $outputfile < $timeforfiletoupdate_beforeerror) { # etc }

is the same as

if (-M($outputfile) < $timeforfiletoupdate_beforeerror) { # etc }

And like every other function, nothing's stopping you from assigning its result to a variable.

$days_since = -M $outputfile;