You might want to look at Proc::ProcessTable. As far as interpreting the values, it's pretty complicated. Google and groups.google search for "linux memoery stats" and read all the fine details about different kernels and the way they report memory usage. For instance, I was testing some c programs, that malloc'd huge memory. Well it never showed up, until I actually used it. It was shown as swap until I actually filled them with values. So it can get pretty complicated with that aspect, and shared library files, etc.
#!/usr/bin/perl
use Proc::ProcessTable;
#############################################################
# Dump all the information in the current process table
$t = new Proc::ProcessTable;
while(1){
foreach $p (@{$t->table}) {
print "\n--------------------------------\n";
foreach $f ($t->fields){
print $f, ": ", $p->{$f}, " ";
}
}
sleep(1);
}