gepebril69 has asked for the wisdom of the Perl Monks concerning the following question:
I want to use the function stat to determine the last modified date of a file. This can be done by
$FileTimeLastMod = (stat ($FileName))[9];But how to detect if something in this function call fails? There is a brief description on the manual page of Perl, but I can't figure out what they mean. English is not my native tongue:
Returns a 13-element list giving the status info for a file, either the file opened via FILEHANDLE or DIRHANDLE, or named by EXPR. If EXPR is omitted, it stats $_ (not _ !). Returns the empty list if stat fails.
What is the code I have to use? Thanks in advance
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: stat : error handling
by toolic (Bishop) on Jan 03, 2013 at 13:38 UTC | |
by gepebril69 (Scribe) on Jan 03, 2013 at 13:51 UTC | |
by marto (Cardinal) on Jan 03, 2013 at 14:00 UTC | |
Re: stat : error handling
by johngg (Canon) on Jan 03, 2013 at 14:03 UTC | |
by gepebril69 (Scribe) on Jan 03, 2013 at 14:08 UTC | |
by Athanasius (Archbishop) on Jan 03, 2013 at 14:20 UTC | |
by johngg (Canon) on Jan 03, 2013 at 16:05 UTC |
Back to
Seekers of Perl Wisdom