Hey List.
I have run into a situation that I am unclear on.
I am making the following assignment during a loop:
push @{$response_hash{$request_id}},{time => "$time",ip_addr => "$ip_address",oids =>
"%response_values"};
Where: response_values is a simple hash containing key,value pairs and $time and
$ip_address are simple scalar vars.
I can iterate through the %response_values hash after it is created localy using
simple foreach my $value (keys %response_values ) syntax, but when I try to include
that iteration when iterating the main response hash, I am not getting any values.
I am using the following syntax:
foreach my $request (sort keys %response_hash) {
print "Response to request_id $request\n";
foreach my $record(@{$response_hash{$request}}) {
print "Time : $record->{time}\n";
print "IP : $record->{ip_addr}\n";
foreach my $response ($record->{keys %response_values} )
{
print "Response to oid : $response =
$response_values{$response}\n";
}
}
}
The other attributes of the %response_hash are printing fine, just not the contents of
the %response_values hash.
I have also tried assigning as a referance, but that does not seem to work either:
push @{$response_hash{$request_id}},{time => "$time",ip_addr => "$ip_address",oids =>
"\%response_values"};
I get an error when trying to referance it later during the main hash iteration:
Type of arg 1 to keys must be hash (not reference constructor) at
H:\nhsParseSnmpLog.pl line 56, near "%response_values}
"
I am pretty confused at this point and would really appreciate any help I could get.
Thanks!!
Jason
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>