Guest_imported
New member
- Jan 1, 1970
- 0
I've pounded away at this code for god knows how long.. I want data from a form plugged into this given hash... its just leaving all the values blank and I'm racking my brain as to why... thanks for the help.
getInputo (\%inputo);
sub getInputo
{
my ($hashRef) = shift; #initialize the variable to hold the hash reference
my ($buffer) = ""; #initialize the buffer to hold info
$year = "year";
read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); #reads in the form info
foreach (split(/&/, $buffer)) #goes through the whole buffer where the input is stored
{
my ($key, $value) = split(/=/, $_); #splits up the input into the date and value
$key = decode($key); #sets the key and value to the decoded values
$value = decode($value);
$hashRef->{$key} = $value; #sets the key and value in the hash table
}
}
sub decode
{
$_ = shift; #the decode function which gets rid of all the stars which represent spaces
tr/+/ /;
s/%(..)/pack('c', hex($1))/eg; #convert any symbols out of hex back to symbols
return($_);
}
getInputo (\%inputo);
sub getInputo
{
my ($hashRef) = shift; #initialize the variable to hold the hash reference
my ($buffer) = ""; #initialize the buffer to hold info
$year = "year";
read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); #reads in the form info
foreach (split(/&/, $buffer)) #goes through the whole buffer where the input is stored
{
my ($key, $value) = split(/=/, $_); #splits up the input into the date and value
$key = decode($key); #sets the key and value to the decoded values
$value = decode($value);
$hashRef->{$key} = $value; #sets the key and value in the hash table
}
}
sub decode
{
$_ = shift; #the decode function which gets rid of all the stars which represent spaces
tr/+/ /;
s/%(..)/pack('c', hex($1))/eg; #convert any symbols out of hex back to symbols
return($_);
}