Well, if you don't have anything in the if block, why not put everything in the one if test? The following is a cleaner example (IMHO) and I've used character classes because they tend to be more efficient than the the /i modifier (they work here only because you had simple regexes). Also, I broke the regexes out into separate tests rather than use the inefficient alternations.
#see if it hasn't been touched in 3 days
if (-M "$logdir/$f" > 3.0 and
#see if file begins with ab or def
( $f =~ /^[Aa][Bb]/ or $f =~ /^[Dd][Ee][Ff]/ ) and
#see if hasn't been zipped already
! ($f =~ /gz\b/ ) ) {
system ("/usr/local/bin/gzip", "$logdir/$f");
}
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.