zdog has asked for the wisdom of the Perl Monks concerning the following question:
The script that I am writing will be used to run a website of a bookstore and at the moment, I am working on the catalog search part.
The script goes to the search part of the srcipt and runs all the lines of it until it seems to stop at some point among the lines:
open(DATA, "books.txt") or die "error opening file $!"; while (<DATA>) { @bookinfo = split(/\|/, $_); chomp(@bookinfo); if ($q{'lang'} eq '' || $bookinfo[1] eq $q{'lang'}) { $matchingwords=0; foreach $word(@search) { if ($_ =~ $word) { $matchBooks[$numMatches] = @bookinfo unless ($matching +words>0); $numMatches++; $matchingwords++; } } } } if (@matchBooks>0) { my $sortby; if ($q{'sort'} eq 'author') {$sortby = 3;} else {$sortby = 2;} @matchBooks = sort {${$a}[$sortby] cmp ${$b}[$sortby]} @matchBooks; my $firstDis; my $lastDis; my $firstDisp; if ($q{'first'}) { $firstDis = $q{'first'}; $firstDisp = $q{'first'};} else { $firstDis = 1; $firstDisp = 1; } if ($firstDis + 9 < $numMatches) {$lastDis = $firstDis + 9;} else {$lastDis = $firstDis + ($numMatches - $firstDis);} $firstDisp = $firstDisp - 1; print '<b>Matching Books</b><br>'; print 'There are '.@matchBooks.' matches.<br>'; print "${firstDis}-${lastDis} are listed below.<br><br>"; print "<nl>"; while ($firstDisp < $lastDis) { ... }
Why is it doing this?
Thanks in advance.
--Zenon Zabinski
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem that I can't find
by Ovid (Cardinal) on Jul 01, 2000 at 10:05 UTC | |
|
Re: Problem that I can't find
by ar0n (Priest) on Jul 01, 2000 at 15:46 UTC | |
|
Re: Problem that I can't find
by chromatic (Archbishop) on Jul 01, 2000 at 20:40 UTC | |
by zdog (Priest) on Jul 01, 2000 at 22:21 UTC | |
|
Re: Problem that I can't find
by tenatious (Beadle) on Jul 02, 2000 at 07:25 UTC | |
|
(zdog) Re: Problem that I can't find
by zdog (Priest) on Jul 02, 2000 at 19:59 UTC |