I always put the shebang line, out of habit. I also always, on all platforms, name the file with ".pl" as extension. And I almost always, also on any platform, execute it with "perl program.pl".

All of this is habits I've acquired, for good or for bad. The shebang line is nice to have there, it makes it clear it is a perl script from the start, it makes it easy to move between platforms (usually) or to a web server, and it allows for switches like -w and others. "use warnings" still isn't available everywhere, especially if you are doing a script for someone else to run on a random webhotel somewhere.

I like the extension aswell, since it tells me what kind of file it is already in the directory list. It has some added benefits with execution on windows, and when dealing with web servers. Some people has lots of arguments against this kind of notation, saying it is a DOS/Windows idea that should be shot on sight - I disagree. Of course it isn't enough metadata for complex handling (lots of people point to Macs here) but it sure is enough for a quick visual check of a directory listing.

Executing explicitly via the perl program however, well, that is mostly just sillyness, some would probably call it "cargo cult execution" or something. It's a silly habit, it still works the way it should, no harm done except pressing a few keys too many. I do however like that I *know* what I am doing. When I type "perl program.pl" I know that I am executing a perl program. If I accidently execute some other file, Perl will just hiccup. I will not start something I don't want to.


You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.

In reply to Re: "perl script.pl args" or "script.pl args" by Dog and Pony
in thread "perl script.pl args" or "script.pl args" by dragonchild

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.