in reply to Multiple conditions matching when pulling OID value with Net::SNMP

Hi Bennco99,

Very simply, you are doing an assignment rather than a test for equality.

Change

if ( $status = $on_commercial ) { print "The ups is normal\n"; } if ( my $status = $on_battery ) { print "The ups is on battery\n"; }

to:

if ( $status == $on_commercial ) { print "The ups is normal\n"; } if ( my $status == $on_battery ) { print "The ups is on battery\n"; }

... and you should be all set.

If you need to compare strings instead of values, use eq instead of ==.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/