$oidfila =~ s/^[0-9\.]+(\.[0-9]+)$//;
This is already a good start, but you're matching - and thus substituting - too much. Leave off the first part and things will be ok:
$oidfila =~ s/\.[0-9]+$//;
In reply to Re: regexp problem - extract all but last part of SNMP OID
by Eliya
in thread regexp problem - extract all but last part of SNMP OID
by llagos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |