#!/usr/bin/perl -w use strict; use File::Find; my @startdirs = qw(/home /var/dir); # list of startdirectories find ( sub { if( /\.html$/ ) { # $_ contains filename without path open (HTML, $File::Find::name) # filename with path or warn "couldn't read from $File::Find::name: $!\n"; while () { if ( /\bExpired\b/i ){ # if Expired found print "$File::Find::name\n"; last; # skip rest of file } # if } # while close (HTML); } # if .html }, @startdirs);