View Single Post
Old Oct 24th, 2005, 10:07 AM   #1
wingz198
Newbie
 
wingz198's Avatar
 
Join Date: Sep 2005
Location: Omaha, NE
Posts: 8
Rep Power: 0 wingz198 is on a distinguished road
Problem with regular expression?

I'm trying to write a program that processes a web log file. Here's an antry example:
3236 "GET /robert/./index.php?page=links HTTP/1.1" "30/Sep/2005:11:11:38 -0400" "Java/1.4.1_05" "-" - - 200 69.177.179.241

I made a regex to get the important parts and trying to print out the first reference for the 'bytes':
$entry =~ /\
                   (\d+)\s+                        #bytes
                   (".*")\s+               #method.url.hvers
                   (".*")\s+               #date & time
                   (".*")\s+               #useragent
                   (".*")\s+               #referer
                   .*\s+.*\s+
                   (\d+)\s+                #statuscode
                   (.*)                    #ipaddy
                   /x;
             $bytes = $1;
             print $bytes;

I get an error
Use of uninitialized value in print at ./prog11.pl line 54 (#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.
when I try to print it out. Is there something wrong with the expression? The way I see it, it should work
wingz198 is offline   Reply With Quote