http://www.perlmonks.org?node_id=904238

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Wait a minute --- what's wrong with these lines ?! These look perfectly fine!

$WAI is an object, which I call getMem() which returns a hashref, I then address a piece of the hashref with ->{'MemTotal'} and take that inside the object's converter function kBToMB().

Is this bad ?? What's a better way to achieve the same thing?

----------------------------

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'}); }