hi , i'm a novice at perl so my prob might b very simple.iwas trying out this simple example for creating a form .when i do by simple html making the code like:
<html> <head> <title> form </title></head> <body bgcolor="red"> <form> <input type="text" name ="foo" value="bar"/> <select name="sport"> <option> water balloon shotput</option> <option> 17-legged race</option> </select> <P>choose ur fav. types of wrestling:</P> <input type ="checkbox" name ="wrestling" value ="mud"/>mud<br /> <input type ="checkbox" name ="wrestling" value= "jello" />jello<br /> </form> </html>
the output page is ok but when i do with cgi programming and code looks like:
#!/usr/bin/perl -w print "content-type:text/html\n\n"; print "<html><head><title> form </title></head>; print "<body bgcolor="red">"; print "<form> <input type="text" name ="foo" value="bar"/>"; print "<select name="sport">"; print "<option> water balloon shotput</option>"; print "<option> 17-legged race</option>"; print "</select>"; print "<P>choose ur fav. types of wrestling:</P>"; print "<input type ="checkbox" name ="wrestling" value ="mud"/>mud<br +/>"; print "<input type ="checkbox" name ="wrestling" value= "jello" />jell +o<br />"; print"</form>"; print "</html>;"
the page is not clean and the print commands and the first two lines r also appearing.how do i remove this?? VAIBHAV

update (broquaint): added formatting and changed title (was NOT gettin clean page)


In reply to Not getting clean HTML using print by Anonymous Monk

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.