note
kennethk
If <c>getMem()</c> is returning a hash reference, then you are dereferencing the hashref into a hash with <c>%{ ... }</c> and then dereferencing a second time using [doc://perlop#The-Arrow-Operator], thus the warning. The preferred syntax would be:
<p><c>sub get_memory_tot {
return $WAI->kBToMB($WAI->getMem()->{'MemTotal'} );
}
sub get_memory_free {
return $WAI->kBToMB( $WAI->getMem()->{'MemFree'} );
}
sub get_swap {
return $WAI->kBToMB( $WAI->getMem()->{'SwapTotal'});
}</c>
<p>See [doc://perlref] and/or [doc://perlreftut] for more explanation.
904238
904238