You're using $1 without testing whether the match succeeded. Either add "or die" to your matches (if not matching would be an exceptional condition), or put your use of $1 within the context of a conditional statement based on the match success.<INFIL> =~ /^cpu\s+(\d+)\s+(\d+)\s+(\d+).*/; @loads = ($1, $2, $3);
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
In reply to Re: Linux CPU usage monitor
by merlyn
in thread Linux CPU usage monitor
by bofh_of_oz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |