in reply to Re: search pattern not terminated
in thread search pattern not terminated

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/ ?

Replies are listed 'Best First'.
Re^3: search pattern not terminated
by GrandFather (Saint) on Jan 22, 2008 at 00:37 UTC

    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";} }
Re^3: search pattern not terminated
by olus (Curate) on Jan 22, 2008 at 00:33 UTC
    if (my($ip,$date,$method,$url,$query,$protocol,$retcode,$byte)=($s_=~ +m/$LOG_PATTERN/)) # + ^