mojo_the_helper has asked for the wisdom of the Perl Monks concerning the following question:

I am haveing a few weird problems with use CGI, the documentation of off www.perldoc.com is helpful, but I am looking for some more spefics.... anyone taking pity on me could help out with spefics, but I will take what I can get, this site has always been good to me.
the errors i get from this code are
Unquoted string "hr" may clash with future reserved word at ./search.c +gi line 116. Bareword "RIGHT" not allowed while "strict subs" in use at ./search.cg +i line 108. Unquoted string "hr" may clash with future reserved word at ./search.c +gi line 122. syntax error at ./search.cgi line 126, near "}[" Unquoted string "hr" may clash with future reserved word at ./search.c +gi line 131. Execution of ./search.cgi aborted due to compilation errors.
and of course here is the code itself
#!/usr/local/bin/perl -wT use strict; use CGI; ... sub begin_html { print start_html( -head=>meta({-http_equiv => 'Content-Type', -content => 'text/html'}), -title=>'Search Results', -BGCOLOR=>'white', -Link=>'black', -vlink=>'black', -alink=>'black'); print table({ -border=>undef, -width=>'100%'},#line 108 Tr( [ td(['Information Technologies']), td({-align=>RIGHT},['Administration']), ] ) ); print hr; #line 116 } sub end_html { print hr; #line 122 print table({ -border=>undef, -BGCOLOR=>'#005533'}, Tr( [ td({-align=>CENTER, font({color=>'white'})}['IT']), #line +126 ] ) ); print hr; #line 131 print end_html;
}

Replies are listed 'Best First'.
Re: use CGI; help or a tutorial?
by gmax (Abbot) on May 18, 2003 at 06:45 UTC

    About your specific problem, you need to export the ":standard" keyword from CGI.

    #!/usr/bin/perl -wT use strict; use CGI qw/:standard/; # <-------- You need this # --- print hr; # ---

    Have a look at our Tutorials section, where there are several CGI-related lessons and check Ovid's course on CGI (off site)

    _ _ _ _ (_|| | |(_|>< _|
Re: use CGI; help or a tutorial?
by Hagbone (Monk) on May 18, 2003 at 23:54 UTC