Hi all, after a bit of advice if I could please? I have the following hash that I'm trying to sort by the value against CPU.
$VAR1 = {
'hostname' => {
'1' => {
'pass' =>
+ 1,
'cpu' =>
+'0.07%',
'box_name
+' => 'hostname',
'capacity
+' => '0.41%'
}
},
'hostname' => {
'1' => {
'pass' => 1
+,
'cpu' => '0
+.04%',
'box_name'
+=> 'hostname',
'capacity'
+=> '0.25%'
}
},
Here's my code, but I'm getting
Use of uninitialized value in numeric comparison (<=>) at ./cpu_check.pl line 157.
so I must not be doing it properly?
foreach my $router ( sort {$results->{1}{cpu}{$a} <=> $results->{1}{cpu}{$b} } keys %$results )
Thank you