use CGI; it takes care of your input from html forms and takes does your sub parseform{} for you. Throw away the sub parseform{} and look at the CGI module. Type 'cgi' into the search bar and read up on the docs.

UPDATE:
email.pl
this code is self explaintory, and eaisily modifiable.
#!/usr/bin/perl use CGI qw/:standard/; $to=param('to'); $from=param('from'); $fromhandle=param('fromhandle'); $subject=param('subject'); $contents=param('contents'); if (param()) { open(MAIL, "|/usr/sbin/sendmail -t") || die "cant open"; print MAIL "To: $to \nFrom: $from ($fromhandle)\n"; print MAIL "Subject: $subject \n\n"; print MAIL "$contents\n"; close(MAIL); print "Content-type: text/html\n\n"; print "To:$to<br>\n"; print "From:$from rather know as: \'$fromhandle\'<br>\n"; print "Subject: $subject<br>\n\n\n"; print "$contents"; } else { print "Content-type: text/html\n\n"; print <<EOF; <html><body> <form action="email.pl" method="post"> to:<br> <input type="text" name="to"><br> from:<br> <input type="text" name="from"><br> from handle:<br> <input type="text" name="fromhandle"><br> subject:<br> <input type="text" name="subject"><br> Contents:<br> <textarea name="contents" rows=30 cols=64></textarea> <input type="submit"> <input type="Reset"> </form> </body> </html> EOF }
-Silent11

In reply to Re: modification of simple form-email script by silent11
in thread modification of simple form-email script by einerwitzen

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.