At 19:25 2002.05.21, 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

You can pass more than one parameter to ParseDate.

my $date = ParseDate(@secureFields[0..2])

....

sub PaseDate
{
    my ($year,$month,$day) = @_;

    ...

}

Would that do what you want?



----------------------------------------------------------
Éric Beaudoin               <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to