Salut voila un bout de code qui me pose quelques soucis. Lorsque
je charge mon tableaux associatif avec comme valeur un tableau,
lorsque je sors de la fonction, ma valeur n'a pas été pris en compte.
Ca sent clairement un probleme d'allocation mémoire lié à la visiblité
de la fonction.
....
#ajout dans le tableau assoc
sub parse_host{
....
if ($i =~ /^hrStorageDescr/){
print "Add to array for $i $datav\n";
push @{ $assoc_host{$i} }, $datav;
}
....
}
sub mysql_save(){
print "Mysql dump\n";
print "---- System info ------\n";
foreach my $i (keys(%assoc_mib)){
print $i . " = " . $assoc_mib{$i} . "\n";
}
root@trunc>./all.pl
Add to array for hrStorageDescr /
Add to array for hrStorageDescr /usr
Add to array for hrStorageDescr /export/data
Add to array for hrStorageDescr /export/mp3
Add to array for hrStorageDescr Real Memory
Add to array for hrStorageDescr Swap Space
Add to array for hrStorageDescr Memory Buffers
Mysql dump
---- System info ------
sysLocation = EPITA-Student, Paris, France
sysDescr = Linux trunc 2.4.20-gentoo-r5 #7 Mon Feb 16 22:36:15 CET 2037 i686
sysUpTime = (1379986) 3:49:59.86
sysName = trunc
sysContact = acide <acide@bombal.org>
---- Ressources infos ------
hrSystemNumUsers = 1
hrSystemProcesses = 44
hrSystemMaxProcesses = 0
hrMemorySize = 255192 KBytes
Can't use an undefined value as an ARRAY reference at ./all.pl line 82.