in reply to Lucy in cgi perl

What you describe is not actually possible with the code you have. Your parse_file sub is eating your entire data file as one record, not six. Have you edited the code since your unwanted results? Or is your text file really six different text files?

Replies are listed 'Best First'.
Re^2: Lucy in cgi perl
by chella2104@gmail.com (Sexton) on Apr 12, 2016 at 05:34 UTC

    Can u tell me how to get only needed result

      Maybe if I knew what you needed. I started to rewrite the stuff for you into a smaller working example but by the time I got the CGI it became less clear what you really want to index and search on and how you want to show it. Looking at your data I think a database would be a superior solution to a search engine like Lucy but maybe the data is just for testing and this is just a practice/toy application?

      The surface issue in the results you're having might be as simple to fix as discarding this stuff. It certainly doesn't belong and is probably muddying your chance at understanding what's really going on with searches and the indexing.

      my @exi=split (/\n/,$excerpt); ... foreach my $v(@exi){ if ($v=~ /$q/){ $report .= qq| <br /> $v <br />|;