sub parseDir { my $self = shift; my $path = shift; # the path to the directroy we are # currently scanning. my $out = shift; # the file we write the results to my $target = shift; # the thing we are searching for my $dir = IO::Dir->new($path) or die "can't open $path : $!"; my @files = $dir->read(); $dir->close(); # Scan all interesting files grep( ( -f "$path/$_" ) and ( $_ =~ m/\.(java|xml|cpp|c|h|inc|pas)$/i ) and ( $self->Scan_File( "$path/$_", $out, $target ) ) , @files ); # Also scan any subdirectories. grep( ( ( -d "$path/$_" ) and ( $_ !~ /^\.+$/ ) and # but avoid . and .. ( $self->parseDir( "$path/$_", $out, $target ) ) ), @files ); }