my %varbindhash0; my %varbindhash1; my %varbindhash2; my %varbindhash3; my %varbindhash4; my %varbindhash5; my $i = 0; while ($i < @OIDs) { $varbindhash$i{OID} = $OIDs[$i]; $varbindhash$i{OID_value} = $OID_VALUEs[$i]; $varbindhash$i{OIDs_data_types_id} = $OIDs_DATA_TYPEs_ID[$i]; $varbindhash$i{OIDs_data_types} = $DATA_TYPEs[$i]; $i++; }
I think you may have misunderstood AppleFritter and dismissed the response a little too quickly. Your code can easily be converted to:
my %varbindhash; my $i = 0; while ($i < @OIDs) { $varbindhash[$i]{OID} = $OIDs[$i]; $varbindhash[$i]{OID_value} = $OID_VALUEs[$i]; $varbindhash[$i]{OIDs_data_types_id} = $OIDs_DATA_TYPEs_ID[$i]; $varbindhash[$i]{OIDs_data_types} = $DATA_TYPEs[$i]; $i++; }
If you're having difficulty with the output (i.e., showing reference addresses instead of values) then I expect the error is elsewhere (i.e., where you're trying to output your results. Show that bit of the code, and we can show you the rest of the way.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re^3: refering to a variable by using other variables
by roboticus
in thread refering to a variable by using other variables
by cocoon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |