Perl : hachage

Fermé
MethJy - 1 mai 2002 à 15:12
 MethJy - 1 mai 2002 à 15:38
arf j ai un petit probleme avec un hachage voila je n arrive pas a additionner les valeurs de deux hachages ... pourtant ce sont bien des scalaires alors ou est la couille ???!!!

%hash = (
1 => 3,
2 => 8
);
%hashb = (
1 => 5,
2 => 3
);

@chaine = keys(%hash);


foreach (@chaine)
{
$hash{$_}+ $hashb{$_}= $hashc{$_};
print"$hashc{$_}";
}

thx d avance
A voir également:

1 réponse

oups dsl mon erreur "$hash{$_}+ $hashb{$_}= $hashc{$_}; "

plutot $hashc{$_}= $hash{$_}+ $hashb{$_}

c bon ca marche ;)
0