Taking Ovid's advice in Before you post ..., I tried to get to the root of the problem before posting the 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


In reply to Problem that I can't find by zdog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.