in reply to Problem with getting the right object

I'm not sure you've given us the right information to help you debug this, but a few lines of your code confuse me.

When do you expect this condition to be false?

if(my $hsp = $hit->hsp('best')){

When do you expect this condition to be false?

if(my $hu_name = $hit->name){

... and when do you expect it to differ from this condition?

elsif(my $hd_name = $hit->name)

Replies are listed 'Best First'.
Re^2: Problem with getting the right object
by lomSpace (Scribe) on May 19, 2009 at 16:24 UTC
    Hello Chromatic!
    I have revised it to make it simpler. I need to parse a blast report. I am using an if/else to print to 2 different
    out files. $hd_out should have:
    Name: 13426|HD
    Percent Identity: 97.0856102003643
    Alignment: Bio::SimpleAlign=HASH(0x4012f2c)

    and $hu_out should have:
    Name: 13426|HU
    Percent Identity: 99.7737556561086
    Alignment: Bio::SimpleAlign=HASH(0x401965c)

    Where "Bio::SimpleAlign=HASH(object)" is should have the actual data, which is an alignment.
    I am confused about dereferencing the hash object since it is a scalar($hu_aln, $hd_aln) in my code


    I am expecting to get two files. Each with the name, Percent ID, and the sequence alignment.
    Your help is appreciated!
    LomSpace

      $hu_aln and $hd_aln contain Bio::SimpleAlign objects. If you read the linked documentation, you may find that one of the methods of that class gives you access to the data you need. It doesn't support a default stringification, so you can't print the object directly and get what you expect. (I don't know what you expect, so I can't tell you which method is likely to help.)