i am getting this error: search pattern not terminated...what could be the problem. I am trying to parse the apache access log:

eg of an entry:

10.25.95.100 ab - [05/Aug/2003:12:00:30 -0700] "GET /creative/2|212727 +4-1;iframe? HTTP/1.1" 200 791
My code:
#!/usr/bin/perl -w use strict; my $s = '10.25.95.100 ab - [05/Aug/2003:12:00:30 -0700] "GET /creative +/2|2127274-1;iframe? HTTP/1.1" 200 791 "-" "Mozilla/4.0(compatible; M +SIE 5.5; Windows 98)""TC1=1067055_5565+067055+0+30fc+3fb5+20742d+1; P +WH=m2w/./o0.Nyvo0/I..d/I./I.; Xc294&2127030&1=1059866137&13384&18337; + Xc15&2127102&2=1060109088&13025&17516; Xc200&2127519&2=1060109135&13 +301&18215" "Imp: 294&18421&2127274&1&13384&1060110030" -'; my $LOG_PATTERN = q{(.*) \- \[(.*)\] \"(.*) (.*)\?(.*) HTTP\/(.*)\" ([ +0-9]*) ([0-9]*)}; print "\$s=$s\n"; my $var10=''; $s =~ /(.*) \- \[(.*)\] \"(.*) (.*)\?(.*) HTTP\/(.*)\" ([0-9]*) ([0-9] +*) \"(.*)\" \"(.*)\"/; print "Trick 1: \$1=$1, \$2=$2, \$3=$3, \$4=$4, \$5=$5, \$6=$6, \$7=$7 +, \$8=$8, \$9=$9, \n", " \$\`=",$`," \$\'=",$',"\n"; my $len = @ARGV; if ($len <1){ print "Usage : perl script_name logfile\n"; exit(); } if (!(-e $ARGV[0])){ print $ARGV[0]," : not exists.\n"; exit(); } open (SEM, "< $ARGV[0]") or die "Cannot open file $ARGV[0]\n"; while () { if (my($ip,$date,$method,$url,$query,$protocol,$retcode,$byte)=($_ =~ +m/$LOG_PATTERN)) { print "IP :",$ip,"\n";} } close(SEM);
when I try to add a trailing /, I get the warning: Use of uninitialized value in pattern match (m//) at learn1.plx line 42

In reply to search pattern not terminated by habel_k

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.