Hi all, I have a problem with one very simple task. I run a scheduled script that checks an application server log for some regExp and stores the end of the file (tell/seek) to continue checking the log from the place it finished before. The problem is that from time to time the server is dropping a line that makes the script stop there (thinks it is an EOF or something)! it is a huge line with some strange unformatted text, even when I try to copy/paste it in textpad i get: "cann't copy ... containing null (code = 0) character". What can I do? I can't bypass this line! here is a main loop code:
while (<LOGFILE>) { #print "$_"; # Found the "PWorld.dumper - total" string in one of the lines if ($_ =~ /(\d{2}):(\d{2}):(\d{2}).+PWorld\.dumper - total/) { $sec = $3; $min = $2; $hour = $1; $tempTime = timelocal($sec,$min,$hour,$day,$mon-1,$year); if ($storedDumpLastTime != 0) { $delta = ($tempTime - $storedDumpLastTime); # delta in +seconds! $lastTime = scalar localtime($storedDumpLastTime); $currTime = scalar localtime($tempTime); $cmdDumpDelta = "opcmon $tag=$delta -object dumpDelta -opt +ion lasttime=\"$lastTime\" -option currtime=\"$currTime\""; } $storedDumpLastTime = $tempTime; $dumpedToday = 1; } #print "line: $_"; } # Store the EOF in the configuration file as the next start point $storedCurrPlace = tell(LOGFILE); close(LOGFILE);
Thanks

In reply to null character problem by leonidlm

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.