in reply to getting the output of command in variable

Depending on your OS (update: or depending on the shell that your perl uses to run a backtick command), this might work:
$cmd = "snmpset ... all those options ... 2>&1"; $x = `$cmd`;
I'm guessing that the reason your initial backtick attempt didn't work as expected is that the snmpset command is printing its output to STDERR rather than to STDOUT. The backtick operator only captures STDOUT from the process being run, but if the process includes a redirection of STDERR to STDOUT, you should get what you want.

BTW, you should not have a space inside the  <code> tag; note that  <c> ... </c> works too.