Hi everybody,
I am far from a regex guru, so I know that I can get advice on how to
learn to improve my regex knowledge so I can better my currently working
code to protect against failure in the future. I would appreciate some
criticism, with explanations as to the changes if possible.
I've made it as brief as possible, with hopefully enough context (sorry
if it wraps):
while (<LOG>) {
if (/.*simscan~\[\d+\]~([\w|\s]+).*?~(\d+\.\d+)s~.*?~(.*?)~(.*?)~(.*)/) {
$result = $1 if $1;
$scantime = $2 if $2;
$ip = $3 if $3;
$from = $4 if $4;
$to = $5 if $5;
__DATA__
# each block is one line
@40000000484550de1062bd84 simscan~[19462]~CLEAN
(-4.90/12.00)~7.1809s~Re_ Querstions about COGENT and their
services...~2001:48a8:6880:95::[EMAIL PROTECTED]@ibctech.ca
@40000000484429a236a97a14 simscan~[73347]~SPAM REJECT
(22.10/12.00)~9.0560s~RE_ La Phaa en
Ligne~::ffff:[EMAIL PROTECTED]@ibctech.ca
__END_DATA__
For those interested, I'm writing a simscan log file compiler, so I can
generate long-term database backed stats that compare email traffic/spam
that I receive on both IPv4 and IPv6 layer-3 protocols.
Thanks,
Steve
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/