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) = @_;
my($buffer) = "";
my($key,$value,$pair,@pairs);
if ($ENV{'REQUEST_METHOD'} eq "GET") {
$buffer = $ENV{'QUERY_STRING'};
}else {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
my($key, $value) = split(/=/, $pair);
$key = decodeURL($key); # Decode the key
$value = decodeURL($value); # Decode the value
%{$hashRef}->{$key} = $value;! # Enter the value in the hash
<----- Deprecated stmt
print "get_form_data_1: Setting $key to [$value]<br>"; #Debug....
}
}
Thanks
Tony
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>