Now I'm confused, I thought a substr would be faster than a regex in this
case as the data is formatted.

Would it?
---------------------------------------------

#!/usr/bin/perl -w
use strict;

while ( <DATA> ) {

    my $user  = substr($_, 0,8);
    my $date  = substr($_, 9,32);
    my $state = substr($_, 38,41);

    print "User: $user\nDate: $date\nState: $state\n";
}
__DATA__
 root    Wed Aug 22 04:44:59 2001     DLs
 root    Wed Aug 22 04:44:59 2001     ILs
 root    Wed Aug 22 04:44:59 2001     DL
 root    Wed Aug 22 04:44:59 2001     DL
 root    Wed Aug 22 04:44:59 2001     DL
 root    Wed Aug 22 04:44:59 2001     DL
 root    Wed Aug 22 04:46:37 2001     Is
 root    Wed Aug 22 11:46:38 2001     Ss
 root    Wed Aug 22 11:46:39 2001     Ss
 daemon  Wed Aug 22 11:46:40 2001     Is
 root    Wed Aug 22 11:46:41 2001     Is
 root    Wed Aug 22 11:46:41 2001     Ss
 root    Wed Aug 22 11:46:41 2001     Is
 root    Wed Aug 22 12:31:21 2001     Is
 postfix Wed Aug 22 12:31:21 2001     I
 root    Wed Aug 22 12:32:21 2001     Ss
 nobody  Wed Aug 22 12:32:21 2001     I







Reply via email to