Thanks for the info, i did try that, and i think i found where the problem sort of is.

This is a extract from a CGI program, so the web interface, reads a log file and parses the info back into html.
So when i use the following code.
#!/usr/bin/perl my $get = "Starting"; open(FH, "/home/cuthbe/programs/perlweb/PCAMWebStatus/log/pd_zvkk.log" +) || die ("Unable to open pd_zvkk log file : !$ \n"); printf ("My get = $get \n"); while(<FH>) { chomp(); #next if ($_ !~ /$get/); if($_ =~ m/$get/) { printf ("String found: \"$_\" : \n"); } $ perl test.pl My get = Starting String found: "Fri Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Start +ing." : (cuthbe@ferrari)-(10:27 AM Mon Nov 14)-(cgi-bin) $
It works perfectly, now this is on the command line.
When i put this into the cgi code, and get it to read the log file."with replacing the log file for variable"
open(FH, "$pd_zvkk") || die ("Unable to open pd_zvkk log file: $pd_ +zvkk : !$ \n"); printf STDERR ("My get = $get \n"); while(<FH>) { chomp(); #next if ($_ !~ /$get/); if(m/$get/) { printf STDERR ("String found: \"$_\" : \n"); } } <code> Then i get this in the apache error log.<br> <code> [Mon Nov 14 10:28:16 2005] [error] [client 10.142.204.242] My get = St +arting [Mon Nov 14 10:28:16 2005] [error] [client 10.142.204.242] String foun +d: "Fri Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Starting." : [Mon Nov 14 10:28:16 2005] [error] [client 10.142.204.242] My get = [Mon Nov 14 10:28:16 2005] [error] [client 10.142.204.242] String foun +d: "Fri Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Starting." : [Mon Nov 14 10:28:16 2005] [error] [client 10.142.204.242] String foun +d: "Fri Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Removing old cl +ientacc files." : [Mon Nov 14 10:28:16 2005] [error] [client 10.142.204.242] String foun +d: "Fri Aug 26 05:56:01 BST 2005 INFO: PD/ZVKK Load: Running the sto +red proc." : [Mon Nov 14 10:28:16 2005] [error] [client 10.142.204.242] String foun +d: "" : [Mon Nov 14 10:28:16 2005] [error] [client 10.142.204.242] String foun +d: "PL/SQL procedure successfully completed." : [Mon Nov 14 10:28:16 2005] [error] [client 10.142.204.242] String foun +d: "" : [Mon Nov 14 10:28:16 2005] [error] [client 10.142.204.242] String foun +d: "could not open /dev/kbd to get keyboard type US keyboard assumed" + :

So it seems like when running in a CGI env it reads and prints the whole log file, very strange.

In reply to Re^2: regex log file too many results by minixman
in thread regex log file too many results by minixman

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.