Nickd_69,
Welcome to the Monastery! Since you will very likely get many responses about using CGI to do your argument parsing, let me point out a couple other things:
  • select can be used to select your default output file handle so you would not have to keep typing print MAIL
  • Invoking a sub-routine as &subroutine instead of subroutine() exposes the sub to the current @_ and is probably not what you want when debugging problems.
  • Try to get in the habit of using warnings (use warnings;) and also strict (use strict;) since it will point out lots of errors for you. Perhaps you might also like use diagnostics;
  • Take a look at Variable Scoping basics from our Tutorials section and the external Coping with Scoping by Dominus. Your use of globals will likely make debugging harder when you find that you have inadvertently used the same variable name and stepped on it elsewhere
  • Finally, reading the Perlmonks FAQ will save you a lot of headache in not getting the answers you are seeking. There is a LOT of information here.

    Cheers - L~R


    In reply to Re: Premature end of script headers by Limbic~Region
    in thread Premature end of script headers by Nickd_69

    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.