Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-24 02:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found