|
|
| There's more than one way to do things | |
| PerlMonks |
Re: Deleting old files from directoryby TomDLux (Vicar) |
| on Sep 27, 2011 at 19:39 UTC ( #928158=note: print w/ replies, xml ) | Need Help?? |
|
Does that even work? "perldoc -f -X" gives the example:
From which I gather the filetests don't take a default "$_". But once you've tested "-f $_", you can re-use the data structure from that query for the -M test by specifying a single underscore: "-M _". Personally I would do it as in the example, with a while, rather than loading all the filenames ... potentially a large number. I would also use a variable rather than "$_", because when you nest loops or call routines, the value of $_ might be altered. As Occam said: Entia non sunt multiplicanda praeter necessitatem.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||