[Bioperl-l] Get tag value into a variable

Paulo Almeida palmeida at igc.gulbenkian.pt
Wed Jan 26 07:51:56 EST 2005


Thanks! That did it.

-Paulo
On Wed, Jan 26, 2005 at 12:30:12PM +0100, Marc Logghe wrote:
> 
> > This is probably a perl problem, rather than a bioperl 
> > problem, but I'm
> > having trouble storing a tag from a feature in a variable. I do this:
> > 
> > print $feat->get_tag_values($tag) , "\n" if $tag eq 'coded_by';
> > my $coded = $feat->get_tag_values($tag);
> > print $coded , "\n" if $tag eq 'coded_by';
> > 
> You have to do that in list context, because there might be multiple values for the same key (eg. multiple note tags)
> so it should read (if you are only interested in the first one, or when there is only 1):
> 
> my ($coded) = $feat->get_tag_values($tag);
> HTH,
> Marc


More information about the Bioperl-l mailing list