in reply to Some problem pattern matching
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Some problem pattern matching
by eMBR_chi (Acolyte) on Apr 07, 2010 at 15:19 UTC |