in reply to RegEx problems

Try changing
my $map = $traps{$trap}{oid} =~ /\.\d+$/;
to
my ($map) = $traps{$trap}{oid} =~ /\.(\d+)$/;
The final digit of an SNMP OID has no particular significance, unless it's an index into a table. (But you probably knew that.)