Here is how to do it without the array and without using grep.
I prefer File::Glob these days since it allows whitespace in the path but it won't work like this in a while loop so I end up with a foreach loop and an array.
#!/usr/bin/perl use warnings; use strict; while (<test/*.txt>) { if (-f && 10 < -M _) { print "\n Deleting::: $_\n"; unlink or warn "--Could not unlink $_: $!"; } }
In reply to Re: Deleting old files from directory
by Lotus1
in thread Deleting old files from directory
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |