i tired like this, so it should get list of genes from subroutine gene and should print all the entries of array. but it gets only a single value. could someone please tell me where and what am i doing wrong...
my $twig= new XML::Twig(); $twig->parsefile( "local.xml"); my $gene_list= $twig1->root; my @genes= $gene_list->children; chomp (my $qname = <STDIN>); sub gene{ foreach my $gene ( @genes) { my $l_name = $gene->first_child( 'Localization'); my $y_name = $gene->first_child( 'Yorf'); my $g_name = $gene->first_child( 'Genename'); my $local_name = $l_name->text; my $yorf_name = $y_name->text; my $gene_name = $g_name->text; if ($local_name eq $qname) { return($yorf_name); } } } @sname =[]; @sname = gene(); print @sname; Thanks in advance Gautam -- +++ Mailpower für Multimedia-Begeisterte: http://www.gmx.net/topmail +++ 250 MB Mailbox, 1 GB Online-Festplatte, 100 FreeSMS. Jetzt kostenlos testen! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>