Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: "perl script.pl args" or "script.pl args"

by Dog and Pony (Priest)
on Jul 18, 2003 at 02:01 UTC ( #275477=note: print w/ replies, xml ) Need Help??


in reply to "perl script.pl args" or "script.pl args"

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.


Comment on Re: "perl script.pl args" or "script.pl args"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://275477]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2014-08-22 21:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (167 votes), past polls