The problem is, what do you mean by "actual" memory usage? Does that include shared memory? Does that include memory used by the program itself? If you fork(), on a modern operating system, memory pages are only copied if either process changes them. How do you count them? Do you include memory swapped out? How about claimed (by the OS), but not used memory? What about file buffers for files opened by the processes involved?
Regardless of the answers of the questions above, you're probably best of using tools geared towards the OS - AFAIK, none of them are written in Perl. Some commercial Unices have good tools available.