Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: LOG FILE HELP IN PERL

by tilly (Archbishop)
on Jan 19, 2011 at 17:12 UTC ( [id://883165]=note: print w/replies, xml ) Need Help??


in reply to LOG FILE HELP IN PERL

Your bug is that you are setting $md5 on every single line of input. So when you hit an error line, you no longer know the md5 from the line before.

To fix it you need to define $md5 outside of the while loop that reads through the file, and then inside the file you need to set it only if the record matched. That way it will get set when you encounter that line, and it will still be set on the error line.

(Incidentally you left two closing braces off of your cut and paste of your script.)

Edit: JavaFan is correct. I'd missed paragraph mode which does fix that potential problem. The cause of the undef warnings is that $UID is not populated, because the UID line is on the second paragraph, not the first. If you add another <$input_fh>; that warning goes away. (This is very, very fragile logic. But it seems to work.)

If there is still no output, then I would advise checking whether it is looking for the files in the right place.

Replies are listed 'Best First'.
Re^2: LOG FILE HELP IN PERL
by JavaFan (Canon) on Jan 19, 2011 at 17:41 UTC
    Your bug is that you are setting $md5 on every single line of input. So when you hit an error line, you no longer know the md5 from the line before.
    Except that he has $/ = "";, which makes it read paragraph by paragraph.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://883165]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-19 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found