--- Matt Simonsen <[EMAIL PROTECTED]> wrote: > I have the following code to parse the line at the bottom of the email. > Basically I want to take the date and convert it into something easy to say > "is this within the last _ days" - the part of this that I think is > particularly sloppy is the whole parsing below the split. Any tips (in > particular how to get the data to ParseDate more cleanly) would be > appreciated- > > > while (<SECURE>) { > next unless /proftpd/ ; > next unless /successful/ ; > > my @secureFields = split ; > > my $combine = "$secureFields[0], $secureFields[1], $secureFields[2]" ; > #doing this to get one scalar to pass ParseDate > > my $date = ParseDate ($combine) ; > > $secureFields[9] =~ s/:$// ; #cleans the username who logged in > > $ftpLogins{$secureFields[9]} = $date ; > } > > Code to parse (on one line): > May 21 16:06:41 email proftpd[3011]: email.careercast.com > (CHIFW5004.arthurandersen.com[170.253.240.1]) - USER arthur: Login successful
Untested: while (<SECURE>) { next unless /proftpd/ && /successful/; my ($user, @date) = (split)[9,0..2]; my $date = join ", ", @date; $date = ParseDate($date); $user =~ s/:$//; #cleans the username who logged in $ftpLogins{$user} = $date; } Cheers, Curtis "Ovid" Poe ===== "Ovid" on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]