Hi,
In my form I have a select box with the name="beverage".
I have 3 options: coffee, tea and milk. I have in my script set up an associative array:
$beverage = param('beverage');
%beverage = (coffee => 'Folgers',
tea => 'Lipton',
milk => 'DairyFresh');
foreach $_(keys %beverage) {
$beverage = $beverage{$_};
}
...and then further in the script I want to see the value chosen from the drop-down menu like this...
print "You chose $beverage.";
...but the value never changes...it's always the last item in the array...DairyFresh
Why?
Where am I going wrong?
In my form I have a select box with the name="beverage".
I have 3 options: coffee, tea and milk. I have in my script set up an associative array:
$beverage = param('beverage');
%beverage = (coffee => 'Folgers',
tea => 'Lipton',
milk => 'DairyFresh');
foreach $_(keys %beverage) {
$beverage = $beverage{$_};
}
...and then further in the script I want to see the value chosen from the drop-down menu like this...
print "You chose $beverage.";
...but the value never changes...it's always the last item in the array...DairyFresh
Why?
Where am I going wrong?