in reply to Tutorial on File::Find even more basic than "Beginners Guide"
use warnings; use strict; use File::Find; open (OUT, ">C://strings.txt"); my $search_string = 'http'; find( \&grep, "C:\\Program Files\\whatever" ); sub grep { my $file = $File::Find::name; if ( -f $file && -r _ ) { open( my $fh, "<", $file ) or return; while ( my $rec = <$fh> ) { print OUT "$rec" #in $_\n" if $rec =~ /$search_string/; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tutorial on File::Find even more basic than "Beginners Guide"
by ww (Archbishop) on Jan 20, 2005 at 23:11 UTC |