in reply to Starting a script according to processes

I only can give you some ideas I had, when I read your post. First, doing while(1) is just asking for cpu trouble. Second, if you need to get subsecond resolution, you will need another approach.

Maybe POE has an example to do this simple task?

I don't know how pslist outputs. But if it has a mode to give continuous output, like top, maybe you could set up a filehandle read on it, so you would only have to open it once( you may need to rewind the filehandle ). Then you could use IO::Select on it when it was readable.

Here is a simple idea using IPC::Open3. This uses relatively little cpu, at .1 second.

#!/usr/bin/perl use warnings; use strict; use IPC::Open3; my $pid = shift || $$; my $pid1 = open3(\*WRITE,\*READ,0,"/bin/sh"); #if \*ERROR is false, STDERR is sent to STDOUT while(1){ print WRITE "ps -o rss= -p $pid\n"; select(undef,undef,undef,.1); my $size = <READ>; #do your checks here and do whatever print "$size"; }

I'm not really a human, but I play one on earth. flash japh