[EMAIL PROTECTED] wrote:
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} ) {
On Friday 14 December 2007 03:22, [EMAIL PROTECTED]
wrote:
>
> All,
Hello,
> 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 || '
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
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
On Dec 14, 2007 6:02 AM, Jase Critchley <[EMAIL PROTECTED]> wrote:
> 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 i
= $_ 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]>
[EMAIL PROTECTED] wrote:
>
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
On Dec 12, 2007 5:42 AM, <[EMAIL PROTECTED]> wrote:
> 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
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
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
John W . Krahn schreef:
> Rodrick Brown:
>> John W. Krahn:
>>> perl -ane'$total+=$F[4]}{printf"Avg: %.2f\n",$total/$.'
>>> /tmp/filename
>>
>> Hi John please explain how exactly $F[4] works? how is it set?
Use -MO=Deparse to show you what Perl code your command line expression
was compiled to.
[ PLEASE! Do not top-post. ]
[ Please remove any text not required for context. ]
On Friday 07 December 2007 12:41, [EMAIL PROTECTED] wrote:
>
> On Fri, 7 Dec 2007, John W.Krahn wrote:
> >
> > On Friday 07 December 2007 04:36, [EMAIL PROTECTED]
> > wrote:
> >>
> >> I am not very good at perl
On Friday 07 December 2007 04:36, [EMAIL PROTECTED]
wrote:
> Hi,
Hello,
> 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.
On Friday 07 December 2007 07:13, Rodrick Brown wrote:
>
> On Dec 7, 2007 9:45 AM, John W. Krahn <[EMAIL PROTECTED]> wrote:
> >
> > On Friday 07 December 2007 06:36, Rodrick Brown wrote:
> > >
> > > perl -nle '$total+= (split/\s+/,$_)[4]; END { printf "Avg:
> > > %.2f\n", $total/$. } ' /tmp/filenam
On Friday 07 December 2007 06:36, Rodrick Brown wrote:
>
> perl -nle '$total+= (split/\s+/,$_)[4]; END { printf "Avg: %.2f\n",
> $total/$. } ' /tmp/filename
perl -ane'$total+=$F[4]}{printf"Avg: %.2f\n",$total/$.' /tmp/filename
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [
perl -nle '$total+= (split/\s+/,$_)[4]; END { printf "Avg: %.2f\n",
$total/$. } ' /tmp/filename
On Dec 7, 2007 7:36 AM, <[EMAIL PROTECTED]> wrote:
> 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 calcula
[EMAIL PROTECTED] wrote:
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
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
18 matches
Mail list logo