* Gavin <[EMAIL PROTECTED]> [030727 06:30]: > I'm trying to run this script I got out of "O'reilly's LINUX SERVER HACKS" [snip] > I copied it line for line, and when I tried to run it I got the message: > > Bareword "LOAD" not allowed while "strict subs" in use at ./tl line 11. > Execution of ./tl aborted due to compilation errors.
Not sure why it didn't work, except that `/bin/hostname` needs to be in backticks, not single quotes. This works for me on the command line: #!/usr/bin/perl -w use strict; $|++; my $host=`/bin/hostname`; chomp $host; while(1) { open(LOAD,"/proc/loadavg") || die "couldn't open /proc/loadavg: $!\n"; my @load=split(/ /,<LOAD>); close(LOAD); # print "\033]0;"; print "$host: $load[0] $load[1] $load[2] at ", scalar(localtime), "\n"; # print "\007"; sleep 2; } I commented out the lines with the octal print codes and added a newline for each line. I don't have that book so I don't know what it is really supposed to do, but I hope this helps. -- Jan Wilson, SysAdmin _/*]; [EMAIL PROTECTED] Corozal Junior College | |:' corozal.com corozal.bz Corozal Town, Belize | /' chetumal.com & linux.bz Reg. Linux user #151611 |_/ Network, PHP, Perl, HTML
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com