Hi, My problem is with File::Find module. I do not exactly understand how it works. On the website it says that for the given directory it does a depth first search for each directory and file.
so when i do this: find(sub{ return if -d; print "file"}, "/example_dir"); it should print as many "file" as I have in /example_dir. Am I right? Thanks, Melis --- "John W. Krahn" <[EMAIL PROTECTED]> wrote: > Barbara Green wrote: > > > > Hi Folks > > Hello, > > > I'm new to Perl, just a few days into it. I would > like to know now I > > can search all files on a server > > perldoc File::Find > > > for names or numbers > > In the file name or in the file itself? > > perldoc perlre > perldoc perlretut > perldoc -f open > perldoc perlopentut > perldoc perlsyn > > > and have perl make > > a list of the found files. > > perldoc perldata > > > Here is an example of what your program may look > like: > > #!/usr/bin/perl > use warnings; > use strict; > use File::Find; > > my $dir_to_search = '/some/dir'; > my $name = 'somename'; > my $number = 876; > my @list_of_files; > > find( sub { > # want files only > return unless -f; > # put current file name into @ARGV > local @ARGV = $_; > while ( <> ) { > # search through contents of current file > if ( /$name/ or /$number/ ) { > # store full file path and return for > next file > push @list_of_files, $File::Find::name; > return; > } > } > }, $dir_to_search ); > > # now do something with @list_of_files > > __END__ > > > > John > -- > use Perl; > program > fulfillment > > -- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > <http://learn.perl.org/> > <http://learn.perl.org/first-response> > > __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>