in reply to Call for (gentle) critique.
These variables that you are binding and using as separate scalars should be encapsulated into two different hashes, one for each set oids:if ($old) { ## deprecated oids $wrnet = ".1.3.6.1.4.1.9.2.1.55.0"; $confnet = ".1.3.6.1.4.1.9.2.1.53.0"; $wrmem = ".1.3.6.1.4.1.9.2.1.54.0"; $flashtotftp = ".1.3.6.1.4.1.9.2.10.9.0"; $tftptoflash = ".1.3.6.1.4.1.9.2.10.12.0"; $eraseflash = ".1.3.6.1.4.1.9.2.10.6.0"; } else { ## oids $wrnet = ".1.3.6.1.4.1.9.2.1.55.0"; $confnet = ".1.3.6.1.4.1.9.2.1.53.0"; $wrmem = ".1.3.6.1.4.1.9.2.1.54.0"; $flashtotftp = ".1.3.6.1.4.1.9.2.10.9.0"; $tftptoflash = ".1.3.6.1.4.1.9.2.10.12.0"; $eraseflash = ".1.3.6.1.4.1.9.2.10.6.0"; }
also since the first part of these numbers does not change, you should store that in a variable:my $data{old} = { wrnet = ".1.3.6.1.4.1.9.2.1.55.0", confnet = ".1.3.6.1.4.1.9.2.1.53.0", wrmem = ".1.3.6.1.4.1.9.2.1.54.0", flashtotftp = ".1.3.6.1.4.1.9.2.10.9.0", tftptoflash = ".1.3.6.1.4.1.9.2.10.12.0", eraseflash = ".1.3.6.1.4.1.9.2.10.6.0" } my $data{new} = { wrnet = ".1.3.6.1.4.1.9.2.1.55.0", confnet = ".1.3.6.1.4.1.9.2.1.53.0", wrmem = ".1.3.6.1.4.1.9.2.1.54.0", flashtotftp = ".1.3.6.1.4.1.9.2.10.9.0", tftptoflash = ".1.3.6.1.4.1.9.2.10.12.0", eraseflash = ".1.3.6.1.4.1.9.2.10.6.0" }
my $prefix = ".1.3.6.1.4.1.9.2"; my $number = "$prefix.10.6.0";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Call for (gentle) critique.
by converter (Priest) on Aug 28, 2001 at 23:58 UTC |