I would like someone to look over my .cgi script. Its not very long, and is for a class. I completed it and am not looking for answers, however it's not working, and I don't understand the errors i'm getting.

#!/usr/bin/perl #c11case2a.cgi - Allows user to enter info use CGI qw(:standard -debug); #print “Content-type: text/HTML\n\n”; #prevent Perl from creating undeclared variables use strict; #declare variables and assign variables my ($item, $C_basket, @basket); #make cookies $C_basket = cookie( -name => "Basket", -value => "@basket", -path =>"../../cgi-bin/chap11"); #send cookies print header(-cookie => $C_basket ); #display Web page Print <<addressForm; <HTML> <HEAD><TITLE>Jarrod Accessories</TITLE></HEAD> <BODY> <H2>Jarrod Accessories</H2> <H3>Enter Your Information</H3><HR> <FORM ACTION="http://endor.vvc.edu/~shaninarice/cgi-bin/chap11/c11case +2b.cgi" METHOD=POST> <TABLE> <TR><TD>Name</TD><TD><INPUT NAME=Name SIZE=40></TD></TR> <TR><TD>Address</TD><TD><INPUT NAME=Address SIZE=40></TD></TR> <TR><TD>City</TD><TD><INPUT NAME=City SIZE=40></TD></TR> <TR><TD>State</TD><TD><INPUT NAME=State SIZE=40></TD></TR> <TR><TD>Zip Code</TD><TD><INPUT NAME=Zipcode SIZE=40></TD></TR> </TABLE> <BP><INPUT TYPE=submit VALUE=Submit> <INPUT TYPE=reset></P> </FORM> </BODY> </HTML> addressForm

And the errors I get running perl -c:

Bareword found where operator expected at c11case2a.cgi line 29, near + "<TITLE>Jarrod" (Missing operator before Jarrod?) Bareword found where operator expected at c11case2a.cgi line 32, near +"<H3>Enter" (Missing operator before Enter?) String found where operator expected at c11case2a.cgi line 33, at end +of line (Missing semicolon on previous line?) syntax error at c11case2a.cgi line 29, near "HEAD>" Can't find string terminator '"' anywhere before EOF at c11case2a.cgi +line 33.
and the second one....

#!/usr/bin/perl #c11case2b.cgi - Displays user info print “Content-type: text/HTML\n\n”; use CGI qw(:standard); #prevent Perl from creating undeclared variables use strict; #declare and assign variables my ($name, $address, $city, $state, $zipcode, $item, $rec, @items); my @purchases = ( “Gold Bracelet”, “Silver Bracelet”, “Diamond Necklace”, “Ruby Earrings”, “Pearl Ring”); $name = param(‘Name’); $address =param(‘Address’); $city =param(‘City’); $state =param(‘State’); $zipcode =param(‘Zipcode’); #get order from cookie @items = split (/ /, cookie (‘Basket’)); #display order confirmation print "<HTML>\n"; print "<HEAD><TITLE>Jarrod Accessories</TITLE></HEAD>\n"; print "<BODY>\n"; print "<H1H2>Jarrod Accesories</H1H2> \n"; print “$name, Thank you for your order of:<BR><BR>\n”; foreach $item (@items) { print “$purchases [$item]<BR>\n”; } print “<BR>It will be shipped to: <BR><BR>\n”; print “$address<BR>\n”; print “$city,$nbsp; $state $nbsp; $zipcode<BR>\n”; print "</BODY>\n”; print “</HTML>\n";

And It's errors:

Bareword found where operator expected at c11case2b.cgi line 10, near + "my @purchases = ( "Gold" (Might be a runaway multi-line "" string starting on line 3) (Do you need to predeclare my?) syntax error at c11case2b.cgi line 10, near "my @purchases = ( "Gold B +racelet" Unrecognized character \xE2; marked by <-- HERE after d Bracelet<-- HE +RE near column 33 at c11case2b.cgi line 10.


In reply to Could you look over my completed (but not working) short .cgi script? by StarRice

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.