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

unless (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"; ########################################
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 empty


In reply to Re^3: Use of uninitialized value $cui1 in print by huck
in thread Use of uninitialized value $cui1 in print by Raksha Jalan

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.