[Bioperl-l] Get tag value into a variable
Marc Logghe
Marc.Logghe at devgen.com
Wed Jan 26 06:30:12 EST 2005
> 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