Re: Calculating Average from a file

2007-12-14 Thread jase . critchley
All, I've had to change the code as due to the earlier version of perl I am running the open line would not work. I found a workaround on the internet use strict; use warnings; my $file = shift @ARGV || 'cpuuse.out'; my %fh = (); if (-f $file and ! $fh{$file} ) { open($fh{$file}, "<$fi

Re: Calculating Average from a file

2007-12-14 Thread Jase Critchley
I'm having to use an old version of perl on some systems and it doesnt like the format of the open my $file = shift @ARGV || 'cpuuse.out'; open my $fh, '<', $file or die $!; Is there another way of opening the file in the same way but different code? Thanks, Jase The sum function is j

RE: Calculating Average from a file

2007-12-13 Thread Jase Critchley
= $_ for @cpu; print $sum / @cpu; ?? Thanks, Jase. -Original Message- From: Chas. Owens [mailto:[EMAIL PROTECTED] Sent: 12 December 2007 12:33 To: Jase Critchley Cc: beginners@perl.org Subject: Re: Calculating Average from a file On Dec 12, 2007 5:42 AM, <[EMAIL PROTECTED]>

Re: Calculating Average from a file

2007-12-12 Thread jase . critchley
All, Thanks for your assistance in helping me with my issues. The script posted by Rob on the 7th works fantastic. However I've discovered that we have a lot of systems out there running a previous version of perl, so much so that I am getting errors within the util.pm. "Array found where opera

Re: Calculating Average from a file

2007-12-12 Thread jase . critchley
I used the script Rob posted a few days with the list::util option and it works. Thanks Rob! However we also use systems we earlier versions of perl it seems. When using the same script I find that it moans about Arrays being present rather than an operator within the util.pm script. Do we use th

Calculating Average from a file

2007-12-07 Thread jase . critchley
Hi, I am not very good at perl however our systems use it and I am trying to write a few scripts to help our staff. I am trying to calculate the average CPU utilisation from a log file which is automatically generated. The columns are space seperated rather than comma. I found some code in this