Bonjour,
Je n'arrive pas a savoir pourquoi j'ai perdu des valeurs entre-temps.
my $reffree = [
'rootdg : ',
'rootdisk (c0t8d0) = 42.33 Go Free ',
'rootmirror (c1t8d0) = 42.33 Go Free ',
'Total 84.66 libre / 26.01 Go utile / 136.69 Go Brut ',
'appsdg : ',
'appsdg01 (AKR_0574_0) = 2.84 Go Free ',
'appsdg02 (AKR_0621_0) = 2.84 Go Free ',
'Total 5.68 libre / 13.79 Go utile / 33.26 Go Brut ',
'perldg : ',
'perldg01 (AKR_0574_3) = 0.54 Go Free ',
'perldg02 (AKR_0621_3) = 0.54 Go Free ',
'perldg03 (AKR_0574_4) = 0.58 Go Free ',
'perldg04 (AKR_0621_4) = 0.46 Go Free ',
'perldg05 (AKR_0574_1) = 7.48 Go Free ',
'perldg06 (AKR_0621_1) = 7.48 Go Free ',
'perldg07 (AKR_0574_2) = 0.00 Go Free ',
'perldg08 (AKR_0621_2) = 0.00 Go Free ',
'perldg09 (AKR_0574_5) = 0.00 Go Free ',
'perldg10 (AKR_0621_5) = 0.00 Go Free ',
'Total 17.07 libre / 326.54 Go utile / 665.33 Go Brut ',
] ;
Résultat, je n'ai pas les deux valeurs attendu perldg07, perldg08 dans le hash.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 foreach ( @$reffree ) { next if ( $_ =~ /^c/ || $_ =~ /root/ || $_ =~ /Total/ || $_ =~ /^$/ ) ; if ( $_ =~ /\w+ :/ ) { ($dgname) = ( $_ =~ /(\w+) :/ ) ; next ; } ($diskname,$diskemc,$diskfree) = ( $_ =~ /(\w+) \((.+)_.* = (.+) Go Free/ ) ; print "$diskname $diskemc $diskfree \n"; $refdg->{$dgname}->{$diskemc}->{$diskfree} = $diskname ; }
Pourriez vous m'expliquer pourquoi, et comment je pourrais remplir correctement mon hash. Merci
$VAR1 = {
'perldg' => {
'AKR_0574' => {
'7.48' => 'perldg05',
'0.58' => 'perldg03',
'0.00' => 'perldg09',
'0.54' => 'perldg01'
},
'AKR_0621' => {
'0.46' => 'perldg04',
'7.48' => 'perldg06',
'0.00' => 'perldg10',
'0.54' => 'perldg02'
}
},
'appsdg' => {
'AKR_0574' => {
'2.84' => 'appsdg01'
},
'AKR_0621' => {
'2.84' => 'appsdg02'
}
}
};
Partager