in reply to Re: Indexing Files with Plucene::Simple
in thread Indexing Files with Plucene::Simple

Thanks for the reply tall_man,

Yes you are right, I am expecting an automoatic index to all files
in ~/MyPerl/QA/data directory.

Regards,
Edward
Update:
Here are ways to populate hash from files with file name as hash key and its contents as values:
. 1.Corion's
map { $_ => do { local ($/,*F); open F, "<$_" or die "Error reading '$_': $!"; <F> }} glob('*') #or map{$_=>do{open my $fh,$_ or die"$_:$!";<$fh>}}glob('*')
2.Aighearach's
package MyPackage; sub make_hash { (local $/)=undef; my (@files,%hash); @files = @_; foreach my $file ( @files ) { open( my $fh, $file ) or next; $hash{$file} = <$file>; }; return \%hash; } __END__
3.atcroft's
foreach $filename (glob('*', '.*')) { open(DF, $filename) or die(); @{$hash{$filename}} = <DF>; close(DF); } #the snippet i mentioned would have had the contents in @{$hash{$fi +lename}}, #but you would have had to reassemble that back into a single strin +g, if that is what you needed)

Replies are listed 'Best First'.
Re^3: Indexing Files with Plucene::Simple
by perrin (Chancellor) on Nov 04, 2004 at 15:19 UTC
    You might have better luck with SWISH-E. It's fast, easy to use, and has a good Perl interface.