in reply to Re^3: Use of uninitialized value $cui1 in print
in thread Use of uninitialized value $cui1 in print

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:  <%-{-{-{-<