Help: Variables problem



Hello,

I'm writing a script to parse the contents of /proc/loadavg file. And the
file is like this:

0.22 0.11 0.03 1/92 2653

And I hope my script output is like this:

1 minute loadavg: 0.22
5 minutes loadavg: 0.11
10 minutes loadavg: 0.03
Running processes: 1 processes
Total processes: 92 processes

And there's my codes:

open LOADAVG, "<", "/proc/loadavg"
or die RED "Can't open /proc/loadavg. $!";
while (<LOADAVG>)
{
<LOADAVG> =~ /(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+(\d+)\/(\d+)\s+\d+/;
print "1 minute loadavg: $1.$2\n";
print "5 minutes loadavg: $3.$4\n";
print "10 minutes loadavg: $5.$6\n";
print "Running processes: $7 processes\n";
print "Total processes: $8 processes\n";
}
close LOADAVG;

But when I excute this codes such errors shows:

Use of uninitialized value in concatenation (.) or string at ./soms.pl line 16, <LOADAVG> line 1.
Use of uninitialized value in concatenation (.) or string at ./soms.pl line 16, <LOADAVG> line 1.
1 minute loadavg: .
Use of uninitialized value in concatenation (.) or string at ./soms.pl line 17, <LOADAVG> line 1.
Use of uninitialized value in concatenation (.) or string at ./soms.pl line 17, <LOADAVG> line 1.
5 minutes loadavg: .
Use of uninitialized value in concatenation (.) or string at ./soms.pl line 18, <LOADAVG> line 1.
Use of uninitialized value in concatenation (.) or string at ./soms.pl line 18, <LOADAVG> line 1.
10 minutes loadavg: .
Use of uninitialized value in concatenation (.) or string at ./soms.pl line 19, <LOADAVG> line 1.
Running processes: processes
Use of uninitialized value in concatenation (.) or string at ./soms.pl line 20, <LOADAVG> line 1.
Total processes: processes

Could you tell me what happens? And how to fix it.

Huge thanks!

Best Regards,

Amy
.