Hi Bruno

It's the "print q"-Statement, if you write it like this, it works:

#!/usr/bin/perl -w

use diagnostics;
use strict;
use CGI qw(:standard);

my $favorite = param("flavor");
print header, start_html("Hello Ice Cream"), h1("Hello Ice Cream");
if ($favorite) {
    print q("Your favorite flavor is $favorite.");
} else {
    print start_form,
    "Please select a flavor: ", textfield("flavor","mint");
    print end_form, hr;
};
exit;

I'm new to perl myself, so haven't found out why textfields aren't working
with "print q". Please let me know if you find out.

Best Regards
Richard



"Bruno Negrao - Perl List" <[EMAIL PROTECTED]> wrote in message
006d01c26b41$fa4d2040$5100a8c0@egp">news:006d01c26b41$fa4d2040$5100a8c0@egp...
> Hi all,
> I'm studying the "Learning Perl Second Edition" and I'm learning cgi now.
>
> The book presents a sample cgi that doesn't produces the expected result
as
> the book says it would. In sumary, this script should generate an one
field
> form with a default value - "mint". But what appears in the screen are the
> strings inside the "q()" function.
>
> Could someone test it and say to me if there is something wrong?
>
> The following script was retired from the section 19.6  "Form Generation".
> #!/usr/bin/perl -w
> # cgi-bin/ice_cream: program to answer *and generate* ice cream
> # favorite flavor form (version 3)
> use CGI qw(:standard);
> my $favorite = param("flavor");
> print header, start_html("Hello Ice Cream"), h1("Hello Ice Cream");
> if ($favorite) {
>     print q("Your favorite flavor is $favorite.");
> } else {
>     print hr, start_form; # hr() emits html horizontal rule: <HR>
>     print q("Please select a flavor: ", textfield("flavor","mint"));
>     print end_form, hr;
> }
>
> I'm running Redhat 6.2 perl version 5.005_03 built for i386-linux
> But i tested this script with RH7.2 v5.6.0 built for i386-linux and it
> doesn't work too
>
> Thanks for any help,
> -------------------------------------------------
>  -- Bruno Negrão -- Suporte
>  -- Plugway Acesso Internet Ltda.
>  -- (31)34812311
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to