I have this snippet of code which works fine.  $start_time has MM-DD-YYYY 
HH:MM:SS.MM which is what I want.

#################################

if ($line =~ /^(\d\d-\d\d-\d{4}\s+\d\d:\d\d:\d\d\.\d\d).+Connection 
Established.+(\d\d\d\d\d)/i) {
         $start_time = $1;
         printf ("Start Time: $start_time\n");

                        }
################################

This snippet though prints out

+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0 
:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0 
:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0 
:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0 
:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0 
:0:0:0:0:0:0+0:0:0:0


################################
if ($line =~ /^(\d\d-\d\d-\d{4})\s+(\d\d:\d\d:\d\d\.\d\d).+Session 
Statistics/i)
  {
         $end_time = $1;
         printf ("End Time: $end_time\n");
    }
################################


This an extract from the log file I am parsing:

09-17-2002 11:34:21.09 - Connection established at 52000bps. -- first regexp
09-17-2002 11:40:46.54 - Session Statistics: -- second regexp

This is the error I get when running:


Use of uninitialized value in concatenation (.) or string at conn_time.pl line
         48, <FH> line 30 (#1)
     (W uninitialized) An undefined value was used as if it were already
     defined.  It was interpreted as a "" or a 0, but maybe it was a mistake.
     To suppress this warning assign a defined value to your variables.

     To help you figure out what was undefined, perl tells you what operation
     you used the undefined value in.  Note, however, that perl optimizes your
     program and the operation displayed in the warning may not necessarily
     appear literally in your program.  For example, "that $foo" is
     usually optimized into "that " . $foo, and the warning will refer to
     the concatenation (.) operator, even though there is no . in your
     program.

Uncaught exception from user code:
         error comparing 09-11-2002 21:23:57.52 and
#### code:
Line 47: $diff =  DateCalc($start_time,$end_time,\$error,1);
Line 48: die("error comparing $start_time and $end_time\n") if($error);
Line 49: print $diff;


What am I doing wrong?

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

Reply via email to