Basically, for the left part of the log line, you could use while
to parse out the information block by block with regex
.
my $str = ".1.3.6.1.4.1.8072.2.3.2.1 = INTEGER: 30 .1.3.6.1.4.1.8072.2.3.2.2 = STRING: lol";
while ($str =~ /([\.\d]+)\s=\s([^:]+):\s([\S]+)/g) {
my ($trap_stuff, $type, $value) = ($1, $2, $3);
print "trap_stuff: $trap_stuff\ntype: $type\nvalue: $value\n";
}
Output:
trap_stuff: .1.3.6.1.4.1.8072.2.3.2.1
type: INTEGER
value: 30
trap_stuff: .1.3.6.1.4.1.8072.2.3.2.2
type: STRING
value: lol