in reply to search pattern not terminated

It may be the missing '/' in:

($_ =~ m/$LOG_PATTERN))

Perl is environmentally friendly - it saves trees

Replies are listed 'Best First'.
Re^2: search pattern not terminated
by habel_k (Initiate) on Jan 22, 2008 at 00:17 UTC
    thanks for your assistance. when i palce a trailing / I get the warning: Use of uninitialized value in pattern match (m//) at learn1.plx line 42
    Where should i be placing the trailing/ ?

      Where did the code come from? I presume (given the level of your questions) that this is not your own code. There are some rather unusual aspects to the code and if you are not a reasonably competent Perl programmer I suspect you will continue to have trouble with it.

      For a start while () {...} is an unterminated loop, which is unlikely to be correct given that there is code following it.

      The match giving you your immediate trouble is against the default variable ($_), but nothing assigns a value to it, hence it is uninitialized (the immediate error). But it is not at all clear what value should be assigned to it.


      Perl is environmentally friendly - it saves trees
        yup....the code is a part of a tutorial and I am trying to built over it and of course this is my first attempt to fiddle with perl....Thanks for your help. The change that i had to make to get things work:
        while (<>) { if (my($ip,$date,$method,$url,$query,$protocol,$retcode,$byte)=($_=~ + m/$LOG_PATTERN/)) { print "IP :",$ip,"\n";} }
      if (my($ip,$date,$method,$url,$query,$protocol,$retcode,$byte)=($s_=~ +m/$LOG_PATTERN/)) # + ^