Without the database it is difficult to run the script. So it might be better to help you debug than to just guess wildly. But nevertheless here is one wild guess: The line

push(@abst_listing,$abstracts[1]);

pushes into @abst_listing without checking the value in $abstracts[$1]. Maybe @abstracts has only one value, that would push the undefined value into @abst_listing, eventually generating an error message like you have seen.

By the way, the error message you get normally tells the variable that is undefined as well as the line number. You should read those error messages with an alert mind and think about it, or if you ask questions somewhere, include this information.

Now to debugging: There is a module called Data::Dumper which prints out data stored in variables of arbitrary complexity. Use that to print out values of variables, arrays, hashes and compare that with what you expect. For example try this:

# at the top of your script: use Data::Dumper; ... my $a; my $b; my $c; # *** find out what the contents of your arrays is print Dumper(\@abst_listing,\@cont_names,\@bact_names); for ($a=0; $a<= scalar(@abst_listing); $a++){ for ($c=0; $c<= scalar(@cont_names); $c++){

The backslash is there to make the output of Dumper easier to read. Run the script and maybe you will see something unexpected in one of your arrays. If you do, concentrate on the lines where this array was filled and try to imagine how such a result could have come about. Maybe put some more Dumper() calls there to check other variables. Or ask about it here, with such detailed information posted you should have a definite answer in minutes


In reply to Re: Some problem pattern matching by jethro
in thread Some problem pattern matching by eMBR_chi

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.