Need help with SNMP perl script

I want to have a script that takes the following:

Runs this Command:
snmpwalk -v 1 -c public devicename 1.3.2.1.15.1.1.3

which returns the following:

SNMPv2-SMI::mib-2.10.1.3.3.54.124.178.134 = INTEGER: 6
SNMPv2-SMI::mib-2.10.1.1.3.62.52.16.38 = INTEGER: 6
SNMPv2-SMI::mib-2.10.1.1.3.62.52.28.51 = INTEGER: 2
SNMPv2-SMI::mib-2.10.1.1.3.101.8.248.5 = INTEGER: 6

I want the script to check if the Integer values are 6, if they are then I want to return:

OK: all values = 6

If the value is not a 6, then I would like it to return the Integer value and have the script truncate the last 4 octects of the script and return:

"Problem Integer value = 2 for 62.52.28.51

Any help is appreciated

Not sure if you want to use perl for that, but maybe you do..anyhow here is an awk version just for kicks:

snmpwalk -v 1 -c public devicename 1.3.2.1.15.1.1.3|gawk '$NF==2{++i;a=$0} END {if($i != 0){ for(var in a) print "problem found " a[var]}}'