Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

RE: Strange Behavior while Parsing Sendmail logs

by flyfishin (Monk)
on Jul 19, 2000 at 18:19 UTC ( #23184=note: print w/replies, xml ) Need Help??


in reply to Strange Behavior while Parsing Sendmail logs

Since we don't have the entire script I am taking a guess here. I assume you are opening the log and reading through each line like so:
open FH, "mylog" etc.... while (<FH>) { do these steps }

If you have the regex you listed in the "do these steps section" then as it is written $to_addr will get assigned the entire line because you have parenthesized that part and set the precedence for the operations. You then run the regex on the line but it never gets assigned to anything again. Try moving the parens so it looks like this:
$to_addr = ($_ =~ rest of stuff);


UPDATE
Oops. Second code section is wrong as DrManhattan pointed out.

Replies are listed 'Best First'.
RE: RE: Strange Behavior while Parsing Sendmail logs
by DrManhattan (Chaplain) on Jul 19, 2000 at 19:19 UTC
    $to_addr = ($_ =~ rest of stuff);

    That will set $to_addr to either 1 or 0 depending on whether the substitution succeeded or not.

    -Matt

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2021-01-21 09:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?