Howdy cocoon, welcome to the Monastery!
What you're looking for there is soft (symbolic) references. You could do something along the following lines:
while ($i < @OIDs) { my $varname = "varbindhash$i"; $$varname{'OID'} = $OIDs[$i]; ... }
See Symbolic references in perlref for more, as well as Programming Perl chapter 8.
But I would advise against doing this, and instead suggest turning your pile of hashes into an array of hashes:
my @varbindhashes = (); ... while ($i < @OIDs) { $varbindhashes[$i]->{'OID'} = $OIDs[$i]; ... }
Refer to perldsc for more on nested data structures, as well as Programming Perl chapter 9.
In reply to Re: refering to a variable by using other variables
by AppleFritter
in thread refering to a variable by using other variables
by cocoon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |