mlhii has asked for the wisdom of the Perl Monks concerning the following question:

while constructing an anonymous array to pass as a reference to the Net::SNMP trap method i noticed that the asn.1 constants could not be quoted in the array. the following does not work: $vb= ".1.3.6.1.4.1.759.1.1.5.3", "OCTET_STRING", "SNMP Agent down"; once the quotes were removed the constant OCTET_STRING was recognized. could find no data explaining why. any thoughts monks? thanks.

Replies are listed 'Best First'.
Re: Net::SNMP and asn.1 constants
by ysth (Canon) on Jul 12, 2004 at 20:32 UTC
    Constants are not interpolated into quoted strings (unless you use one of the tricks to interpolate code, e.g. "@{[OCTET_STRING]}".

    Constants are actually implemented as subroutines (though the actual call is optimized away). Just as "x foo() y" doesn't call foo, "OCTET_STRING" is just a string, not a call to OCTET_STRING.