[ABE.pm] trapping warnings

Faber J. Fedor faber at linuxnj.com
Thu Oct 4 17:03:56 PDT 2007


I've got some code like this:

  $sum = $indexTable2->elm($i, "weight");
  while ($sum <= $captPercentile) {
      $sum += $indexTable2->elm($i+1, "weight");
      $bottom_count ++;
      $i++;
  }

If indexTable2 is empty (it should never be, but hey this is RL), I get
errors like:

Row index out of range [0..-1]Use of uninitialized value in addition (+) at /home/sqa/bin/processMonthlyData.pl line 497.

And the program will sit in that loop forever, spitting out this
warning/error to STDOUT.

How do I trap this and DIE with an error message?


-- 
 
Regards,
 
Faber Fedor
President
Linux New Jersey, Inc.
908-320-0357
800-706-0701

http://www.linuxnj.com




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the ABE-pm mailing list