For logging, use something like Log::Any. In the line just before where the error is occuring, I would $log->debugf("DIcas_text='%s', HR=%s", \@HR); -- but that will add to your log whether or not there was an error.
As for debugging the problem: see perldiag#Use of uninitialized value: something in your @HR is coming up as an undef.
Armed with that knowledge, I might change the logging to something like what's used in the following SSCCE:
use warnings; use strict; use Log::Any qw($log); use Log::Any::Adapter ('File', './debug.log'); sub errcheck_array { my $logger = shift; my $prefix = shift; my $count = grep {!defined} @_; # count the number of undefined el +ements in input array return unless $count; # this line will prevent a log mes +sage unless there's an undef; comment it out to log _all_ calls, whet +her or not there's an undefined value $logger->debugf("%s: %d undefined values found in %s", $prefix, $c +ount, \@_); 1; } foreach my $hr ( [qw(a b c)], [a => undef, b => undef, 'c'], [qw(x y z +)] ) { my @HR = @$hr; my $DIcas_text = '%s' . ',%s'x$#HR; errcheck_array($log, "sprintf('$DIcas_text', \@HR)", @HR); my $EVmsg = sprintf($DIcas_text, @HR); print "STD OUTPUT> $EVmsg\ +n"; }
In reply to Re: Troubleshooting perl runtime errors
by pryrt
in thread Troubleshooting perl runtime errors
by lvirden
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |