in reply to incorporate Ctrl+z of unix in Perl code

Ctrl+z is the way to get out of top on HP-UX? It's not 'q' like any other top? In most terminals/shells, 'ctrl+z' is the suspend key, which sends a SIGSTOP to the process. This suspends the process - it doesn't terminate it. Suspending means the process no longer gets a timeslice on the CPU - and will last until the process is killed, or a SIGCONT.

But regardless, if you run top as system "top", it ought to be running in the foreground, and all keyboard input should be directed to it. So, if indeed, on your system, 'ctrl+z' isn't the suspend key (check stty -a), but the normal way to stop top, it ought to work.