in reply to perl function for 'ps' ?

CPAN has a scripts section for Unix System Administration. There's a couple of scripts there that might help you. There's a script for ps called p-1.0. For auditing, there's a script that will help that's called sperl-1.00.

Scripts Category UNIX: System_administration

p-1.0

sperl-1.00