in reply to Re^2: Use of uninitialized value $cui1 in print
in thread Use of uninitialized value $cui1 in print
Ah, the joys of debuging by proxy. it seems i missed something in the debug statements and print 'new cu1:'.$cu1."\n"; should have been print 'cui1 :'.$cui1."\n"; and print 'new cu2:'.$cu2."\n"; should have been print 'cui2 :'.$cui2."\n";
but this simple exercise has located the problem anyway, in that on i=405 the cu1/cu2 arrays are empty. that means the pops return undef and hence your error. is there anything different about 405? as noted by AnomalousMonk the strings in @w have leading spaces, is that true only on 405? Maybe that is the problem and needs to be fixed somehow, in @new or by regexp maybe.
to workaround this for now you could change to
Notice how it aborts the rest of the loop if either of the arrays are empty. Notice it also includes the updated debug statements. Notice you may want to expand the output printed if they are emptyunless (scalar(@{$cu1})) {print "cu1 is empty\n"; next} my $cui1 =pop @{$cu1}; ######################################## print 'cui1 :'.$cui1."\n"; ######################################## my $cu2 = $umls->getConceptList($t2);***error ######################################## print 'raw cu2:'.$cu2."\n"; print 'size cu2:'.scalar(@{$cu2})."\n"; print 'cu2 :'.join('|',@{$cu2})."\n"; ######################################## unless (scalar(@{$cu2})) {print "cu2 is empty\n"; next} my $cui2 = pop @{$cu2}; ######################################## print 'cui2 :'.$cui2."\n"; ########################################
|
|---|