Hi,
I'm a complete newbie, so have some patience. :)
Im walking through the book 'Learning Perl' by O'Reilly and I'm allready
in a small problem.
I'm trying to compile the following:
====================
#!/usr/bin/perl -w
## cgi-bin/ice_cream: program to answer and generate ice cream
## order form (version 4)
use strict; # enforce variable declarations and quoting
use CGI qw(:standard);
print header, start_html("Ice Cream Stand"), h1("Ice Cream Stand");
if (param()) { # the form has already been filled out
my $who = param("name");
my $flavor = param("flavor");
my $scoops = param("scoops");
my $taxrate = 1.0743;
my $cost = sprintf("%.2f", $taxrate * (1.00 + $scoops * 0.25));
print p("Ok, $who, have $scoops scoops of $flavor for \$$cost.");
} else { # first time through, so present clean form
print hr(); # draw a horizontal rule before the form
print start_form();
print p("What's your name? ", textfield("name"));
# FOR EXPLANATION OF FOLLOWING TWO LINES, SEE NEXT SECTION
print p("What flavor: ", popup_menu("flavor",
['mint','cherry','mocha']));
print p("How many scoops? ", popup_menu("scoops", [ 1..3 ]));
##Problem started here
%flavors = (
mint => "Mighty Mint",
chocolate => "Cherished Chocolate",
cherry => "Cheery Cherry",
vanilla => "Very Vanilla",
peach => "Perfectly Peachy",
);
print scrolling_list(
-NAME => "flavors",
-LABELS => \%flavors,
-VALUES => [ keys %flavors ],
-SIZE => 3,
-MULTIPLE => 0, # 1 for true, 0 for false
);
##End of problem
print p(submit("order"), reset("clear"));
print end_form(), hr();
}
print end_html;
====================
(Indeed, it is the example program. :))
It all worked fine untill I pasted the ## Problem part ##. In my logs I
see the following message:
====================
Global symbol "%flavors" requires explicit package name at dhcptest.cgi
line 22.
Global symbol "%flavors" requires explicit package name at dhcptest.cgi
line 31.
Global symbol "%flavors" requires explicit package name at dhcptest.cgi
line 32.
====================
Can some explain to me what that means and how to fix it? :)
Thanks,
Mark
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]