It might be helpful to specify which first line.

To fill in that blank, the first line that isn't necessary is the shbang line (the one that starts with #!/...) at the top of the module's source. It is necessary at the top of the main program's source, however.

While we're at it, let's give a reason so that in the future it's easier to remember: The operating system needs to know what program to use to interpret the lines of code that follow. One could specify #!/bin/sh for a shell script, for example. But for a Perl script, we want to direct the operating system to our installed Perl interpreter.

Since it is the main program that is invoked by the user as an executable command, that is where the shebang needs to be located. That's the only point where the operating system wouldn't know what to do, if the #!/... line weren't there. Once the main program is invoked and the Perl interpreter is fired up, perl handles calling and executing the modules. perl already knows where it lives, and doesn't need for the modules to specify a location. Luckily since the line is set up to look like a comment, it's just ignored when it appears at inappropriate places.


Dave


In reply to Re^2: help me with errors in perl module. by davido
in thread help me with errors in perl module. by veerubiji

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.