if (!defined($snmpsession)) { #whatever code here, doesn't matter }