>Timothy Johnson wrote:
>
>>It depends on what you're trying to do.  if $hashRef is a hash
>>reference, then the correct syntax would be:
>>
>>   $hashRef->{$key} = $value;
>>
>>or
>>
>>   %{$hashRef}{$key} = $value;
>>
>>What you're saying below is something like:
>>
>>-- Take $hashRef and dereference it to %HASH1 (I'm giving it a name
>>   for clarity)
>>-- Then use %HASH as a reference to another hash, let's say %HASH2.
>>-- Finally, use the -> operator to get the $key key of the hash
%HASH2.
>>
>>
>>If this doesn't answer your question, then you will need to give us
some
>>examples.
>>
>
>Thanks for the quick response, Timothy. Here is the function in
question 
>and a representative calling sequence....
>
>Calling sequence...............
># Form buffer
>my(%FIELDS,$query,$code,$checks);

># Get data from form (get_form_data_1 is local to this program) !!!!
>&get_form_data_1(\%FIELDS);

>Function........................
>sub get_form_data_1 {
>   my($hashRef) = @_;
>

<snip>

>     %{$hashRef}->{$key} = $value;!    # Enter the value in the hash 
><----- Deprecated stmt
>      print "get_form_data_1: Setting $key to [$value]<br>"; #Debug....
>   }
>}

It looks like the syntax you are looking for is

       $hashRef->{$key} = $value;


When you use the -> operator, you are indirectly accessing the value for
the hash POINTED TO by the scalar on the left side.  So you're basically
saying that

       $hashRef->{$key}

is the key "$key" of the hash that $hashRef is pointing to.  


FYI, I should correct the typo in my first email.  If you want to use
the %{$hashRef} syntax, then it should be:

       ${$hashRef}{$key}

NOT

       %{$hashRef}{$key}




--
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