Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use File::Find; my $dir = 'C:\directoryHere'; my $ct = 0; my $hit; my $line; my $nameOne = 'Jackson and Smith and Richards'; my $nameTwo = 'JSR'; my @data; my @files; sub mySub { if( $_ =~ /\.(?:html?|cfm|cfml|cgi|js|pl|asp)$/) { my $name = $File::Find::name; open ( FLE, $name ) || warn "Can\'t open File $name: $!\n"; while($line = <FLE>) { for $hit ($line =~ /(?:$nameOne|$nameTwo)/gi) { print "WEB PAGE ->\t$name\n"; $ct++; } } close FLE; } } find( \&mySub, $dir ); print "Total Web page matches = $ct\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Counting web page hits
by Roy Johnson (Monsignor) on Mar 02, 2004 at 20:15 UTC | |
by Anonymous Monk on Mar 04, 2004 at 11:27 UTC |