Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Hello Monks

I really did not want to ask this but i am really stuck and have no way out so desperately in need of some guidance. I'm trying to create a script that read a large file of sendmail log, store it in $HoAoA and grep the email address entered from prompt and return all the entries related to that email based on the $id. This is what i have now.

#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper; <
my %HoAoA;
while ( <DATA> ) {
my @fields = split(/:,\s+/, $_, 4);
push @{ $HoAoA{$fields1} }, [ @fields0,2,3 ];
}
my @addresses;
foreach my $id ( keys %HoAoA ) {
if ( grep(/econgame\@worldgameofeconomics.com/, $HoAoA{$id}->[0]1, $HoAoA{$id}->11) ) {
push @addresses, $HoAoA{$id}->[0]1, $HoAoA{$id}->11;
}
}

__DATA__
Dec 8 08:49:21 b.mx.sonic.net sm-mta18242: jB8GnCuK018242: from=<cj@oreilly.com>, size=10731, class="0", nrcpts=2, msgid=<E4461FEB-1B74-4612-80DC-3A39B04D89B1@oreilly.com>, proto=ESMTP, daemon=MTA, relay=mwest.oreilly.com 209.204.146.24
Dec 8 08:49:21 b.mx.sonic.net sm-mta17961: jB8Gn2v5017961: lost input channel from 200216009099.user.veloxzone.com.br 200.216.9.99 to MTA after rcpt
Dec 8 08:49:21 b.mx.sonic.net sm-mta17961: jB8Gn2v5017961: from=<je-hurn@mamma.com>, size=0, class="0", nrcpts=0, proto=SMTP, daemon=MTA, relay=200216009099.user.veloxzone.com.br 200.216.9.99
Dec 8 08:49:21 d.mx.sonic.net sm-mta6438: jB8Gn1iU006438: Milter: to=<econgame@worldgameofeconomics.com>, reject=550 5.7.1 Recipient declines mail from 221.233.54.253, (DUL), see http://www.mail-abuse.com/cgi-bin/lookup?ip_address=22 1.233.54.253
Dec 8 08:49:21 c.mx.sonic.net sm-mta30845: jB8GgMPb030845: from=<Michael@MichaelRomano.net>, size=2786810, class="0", nrcpts=0, proto=ESMTP, daemon=MTA, relay=b.mail.sonic.net 64.142.19.5
Dec 8 08:49:21 b.mx.sonic.net sm-mta18528: jB8GnCuK018242: to=<mkirk@corp.sonic.net>,<dane@corp.sonic.net>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=160731, relay=lds.sonic.net. 208.201.249.231, dsn=2.0.0, stat=Sent (jB8GnLpC004736 Message accepted for delivery)
Dec 8 08:49:21 a.mx.sonic.net sm-mta3699: jB8Gn9Vt003699: Milter: to=<cvd@sonic.net>, reject=550 5.7.1 Recipient declines email from 80.54.242.112, <spamhaus-xbl>, Ref: http://www.spamhaus.org/query/bl?ip=80.54.242.112 Dec 8 08:49:21 a.mx.sonic.net sm-mta3699: jB8Gn9Vt003699: lost input channel from host2-112.btk.net.pl 80.54.242.112 to MTA after rcpt
Dec 8 08:49:21 a.mx.sonic.net sm-mta3699: jB8Gn9Vt003699: from=<qfqsoftmtja@hotmail.com>, size=0, class="0", nrcpts=0, proto=SMTP, daemon=MTA, relay=host2-112.btk.net.pl 80.54.242.112

It works for some emails such as cj@oreilly.com but not for all. I really don't understand why. Please help. Thank you all.

In reply to Please help with %HoAoA by vboy1997

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!
  • 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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (7)
    As of 2015-07-04 02:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (57 votes), past polls