12345678910111213141516171819202122232425
use strict;use Data::Dump qw(dump);use Carp;my $res = {}; # Resultsmy $i = 1;while(my $line = <DATA>){ $line =~ /\((.*)\)/; my @in = split /\s+/, $1; my $s = qq($i => {$in[1] => "$in[2]", $in[5] => "$in[6]"}); #print "$s\n"; my $ref = eval($s) or croak "$@\n"; $res->{$i} = $ref; $i++;}print dump $res;__END__Wed Mar 23 13:00:28 2011 : Auth: Login OK: [00-11-0A-FA-FB-AA/NOPASSWORD] (from client kgn751 port 31045 cli 00-11-0A-FA-FB-AA)Wed Mar 23 13:01:02 2011 : Auth: Login OK: [00-0B-5D-0B-D6-44/NOPASSWORD] (from client WabeN7-55 port 11031 cli 00-0B-5D-0B-D6-44)Wed Mar 23 13:01:22 2011 : Auth: Login OK: [00-00-85-7B-44-F7/NOPASSWORD] (from client e1-110-west port 36 cli 00-00-85-7B-44-F7)Wed Mar 23 13:01:37 2011 : Auth: Login OK: [00-C4-FF-7F-34-07/NOPASSWORD] (from client e1-111-west port 76 cli 00-C4-FF-7F-34-07)Wed Mar 23 13:05:29 2011 : Auth: Login OK: [08-37-FF-0C-E7-39/NOPASSWORD] (from client e1-140-west port 3 cli 08-37-FF-0C-E7-39)
1234567
{ 1 => { cli => "00-11-0A-FA-FB-AA", client => "kgn751" }, 2 => { cli => "00-0B-5D-0B-D6-44", client => "WabeN7-55" }, 3 => { cli => "00-00-85-7B-44-F7", client => "e1-110-west" }, 4 => { cli => "00-C4-FF-7F-34-07", client => "e1-111-west" }, 5 => { cli => "08-37-FF-0C-E7-39", client => "e1-140-west" },}