Forgive me, monks. My copy of Learning Perl, The Perl Cookbook, and Programming Perl is buried in a storage locker.

I'm currently working on a simple script that watches for processing that hog the CPU. I'm not really interested in monitoring CPU time. I want to take the "ps" output from a Linux system, snap up the PIDs of processes "currently" using > $percentage of the CPU, sleep for a bit, and repeat the process. After a few loops, I want to kill these processes.

I'm getting stuck at using a custom if() statement. I have a neat and clean variable at the top of the script:
$operator = '> 98.0';

This doesn't seem to work in this context:
if ($consumption $operator) { do something; }

I know there's a way to achieve this, but I don't remember how. Any help, is as always, very much appreciated.

Thanks guys!

In reply to Using dynamic operators in an if() statement by captkirk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":