in reply to Determining memory usage of a process...

Check out GTop which sits on top of libgtop.

my $mem = GTop->new; print "Total memory: ", $mem->total / 1024, "K\n";

Edited by planetscape - closed code tag

Originally posted as a Categorized Answer.