Hmmm...
my %all_the_stuff = ();
my $current;
while( <> ){
chomp;
next unless length;
if( m/^KEY: (.+)/ ){
$current = {
OID => [], #you migth want to put these two
NAME => [], # together, i don't know
ERROR => undef,
};
$all_the_stuff{ $1 } = $current
}
next unless $current;
if( m/^(OID|NAME): (.+)/ ){
push @{$current->{$1}},$2
}
elsif( m/^Error Status (.+)/ ){
$current->{ERROR} = $1;
$current = undef; #error status is final statement
}
}
See perlref,perllol, perldsc and perhaps perlre. The code is untested and not to be used without careful analysis.
--
http://
fruiture.de