What OS? (It's relevant):
- Sys::Statistics::Linux for linux.
- http://search.cpan.org/~doneill/Memory-Usage-0.201/lib/Memory/Usage.pm (OS not known, but how I found it is something you could and should have done for yourself.)
- Determining memory usage of a process... (found with Super Search, which would also like to be your friend.)