Matt Simonsen 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
while ( <SECURE> ) { next unless /proftpd/ and /successful/; my ($date) = /(\w+\s+\d+\s+[\d:]+)/; my ($user) = /USER\s+(\S+):/; $ftpLogins{$user} = ParseDate( $date ); } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]