I have never used nor even seen the UMLS::Similarity::lch module before and, after a brief perusal, have only the vaguest idea of what it is supposed to do. However, total ignorance should never prevent a righteous monk from offering an opinion! So...

my $cu1 = $umls->getConceptList($t1); #calling function from umls::sim +ilarity #ERRRO 1 as mentioned my $cui1 =pop @{$cu1}; my $cu2 = $umls->getConceptList($t2);***error my $cui2 = pop @{$cu2}; print $cui1; # ****ERROR2 unintialized $cui1 my $lvalue = $lch->getRelatedness($cui1, $cui2);

If the value (which should be an array reference) returned to  $cu1 by the call to the  getConceptList() method in the
    my $cu1 = $umls->getConceptList($t1); #calling function from umls::similarity #ERRRO 1 as mentioned
statement is undefined or is a reference to an empty array, the value assigned to  $cui1 by the pop in
     my $cui1 =pop @{$cu1};
will be undefined, as your comment to the
     print $cui1;    # ****ERROR2 unintialized $cui1
statement suggests.

Because an undefined  $cui1 will become an undefined  $concept1 within the call to the  getRelatedness() method, you will get a warning like "Use of uninitialized value $concept1 in string eq at UMLS/Similarity/lch.pm ... at the line number associated with the
    if($concept1 eq $concept2) { $length = 1; }
statement in getRelatedness().

So your first step is to determine whether  $cu1 is undefined or a reference to an empty array. I would do this with a Data::Dumper print debugging statement after the method call:
    my $cu1 = $umls->getConceptList($t1);
    print Dumper $cu1;
Once you know the value of $cu1, you can figure out from the documentation (or the source) of  getConceptList() why it has this value given that you know the value $t1.

I hope this helps. It seems you've already gone quite a way through the steps I've outlined, but maybe this will help clarify things a bit.


Give a man a fish:  <%-{-{-{-<


In reply to Re^4: Use of uninitialized value $cui1 in print by AnomalousMonk
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.