
billydean
Deleted
Mar 24, 2000, 2:14 PM
Post #1 of 5
(471 views)
|
Hi I am trying to write a simple search for a file, but it will only find certain text. I only use single words like "al", and i know that that word is in more than one file.Is the method I used bad? here it is: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> #!/perl/bin/perl $in=<STDIN>; $path="/windows"; opendir(DIR, $path); @a=grep(/./, readdir(DIR)); closedir(DIR); for($d=0;$d<=$#a;$d++) {$file=$a[$d];$filepath="$path/$file";open(FILE, $filepath);@$file=<FILE>;close(FILE); for($e=0;$e<=$#$file;$e++) {if ($$file[$e]=~/$in/i) {print "$file\n"}}}; END</pre><HR></BLOCKQUOTE>
|