Salut...
J'ai une fonction mapping() comme suit :
sub mapping() {
my $file = shift @ARGV or die "You must provide a file as first element";
use XML::Twig;
my $twig=XML::Twig->new(twig_roots=>{'residue'=> \&xml_entry});
$twig->parsefile($file) or die "cannot parse [$file]: $!";
sub xml_entry {
my ($t, $el) = @_;
my %up_pdb;
my @crossRefDb = $el->children('crossRefDb');
foreach (@crossRefDb) { if($_->{'att'}->{'dbAccessionId'} eq "O00204" ) {
my $spr_num = $_->{'att'}->{'dbResNum'};
my $pdb_num = $_->parent()->{'att'}->{'dbResNum'};
$up_pdb{$spr_num} = $pdb_num;
}
}
}
} |
my $hash_ref = &mapping();
Sans rentrer dans le detail, jaimerais retourner la hash "%up_pdb" a l'instruction qui appelle mapping() et qui se trouve dans le main et non pas xml_entry... comment dois-je faire ?
Message édité par radioh le 21-09-2006 à 01:06:46