I would recommend that you have a look at Proc::ProcessTable - It provides a very easy and neat interface to the /proc filesystem for the delivery of this information (as opposed to parsing the output of ps). There is a review of this module on this site with examples of usage from myself here and here.