Got it. I missed your note on the whitespace.

Thanks everyone !!

> 
> From: "Charles K. Clarkson" <[EMAIL PROTECTED]>
> Date: 2004/03/25 Thu PM 03:35:08 GMT
> To: <[EMAIL PROTECTED]>,  <[EMAIL PROTECTED]>
> CC: <[EMAIL PROTECTED]>
> Subject: RE: Hash Help Needed !
> 
> [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> : 
> : 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"};
> 
>     I didn't test your code but "%response_values" is not the
> same as \%response_values or %response_values. You have just
> run into the problem with unnecessarily quoting variables.
> (Read perlfaq4.)
> 
>     You might have wanted (White space is your friend.):
> 
> 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:
> 
>     Add this near the top of your script. It adds a function
> named Dumper to your script.
> 
> use Data::Dumper 'Dumper';
> 
> : 
> : foreach my $request (sort keys %response_hash) {
> :     print "Response to request_id $request\n";
> :     foreach my $record(@{$response_hash{$request}}) {
> 
>     Test what is in $record with the Dumper function:
> 
>     print Dumper @record;
>     exit;
> 
>     Is the result what you thought was in there?
> 
> 
> :     
> :             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";
> :             }
> :     }
> :             
> : }
> 
> HTH,
> 
> Charles K. Clarkson
> -- 
> Mobile Homes Specialist
> 254 968-8328
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to