Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: "perl args" or " 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 args" or " 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".

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" 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 args" or " args"

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2015-10-13 07:16 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (296 votes), past polls