> Thus spoke Wiggins d'Anconia <[EMAIL PROTECTED]> last [2003-02-04 14:04]:

[snip]

> >Use of uninitialized value in concatenation (.) or string at 
> >./diamond-optr.pl line 15, <> line 22.
> >
> 
> This looks like it might be caused by lines in your log file that do not 
> have 8 space delimited fields, in other words it is trying to print the 
> time field, but the time field does not exist (has not been initialized) 
> so it is warning you.  You should check that $string[7] is defined.
> 

dear wiggins and all,

first off, thanks for your replies. you guys are very helpful.

yep i found the errant lines in the log causing the problem. i deleted
them lines and errors gone. i wasn't  able to improve much the script i
started. its kinda hard dividing my non-programming work and perl
together. 

i take this chance to thank John W. Krahn for providing answer to my
problem. His code does it and i modified it a bit:

#!/usr/bin/perl -w
use strict;

my $time = 0;
while (<>){
    next unless /Connect time ([\d.]+) minutes/;
    $time += $1 / 60;
}
printf "time consumed is %.2f hours\n", $time;

question: in the regexp above, inside the character class, is the dot
any char or a literal dot? i read it as: either a digit or a dot, one or
more times. Nice day all.

-- 
Regards,
Eri Mendz
Using Perl, v5.8.0
Linux 2.4.19-16mdk i686


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to