You could instead call glob, which combines directory search and pattern matching on file names. With that you can write,
Yet another way is with File::Find. That would be the choice if you wanted to process subdirectories, too.for (glob '*.{log,txt}') { -M > $expiration and system '/usr/bin/gzip', $_; }
After Compline,
Zaxo
In reply to Re: Opendir and regex
by Zaxo
in thread Opendir and regex
by homer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |