You can use stat and POSIX::strftime() to extract the mtime year. I think mtime is the proper concept, since in a way it is when the file was created in its current form.
Here's a small demo:
That gives you the year as a string, but you can add zero to that if you want it taken as a number.$ cat >foo.txt [Ctrl-D] $ perl -MPOSIX=strftime -e'print strftime("%Y\n", > localtime((stat "foo.txt")[9]))' 2007 $
After Compline,
Zaxo
In reply to Re: extracting year of a file
by Zaxo
in thread extracting year of a file
by Banshee06
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |