Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Please Help! This is a class assignment given to me.

by haukex (Archbishop)
on Dec 07, 2019 at 10:01 UTC ( [id://11109794]=note: print w/replies, xml ) Need Help??


in reply to Re: Please Help! This is a class assignment given to me.
in thread Please Help! This is a class assignment given to me.

Every perl program starts with the same three lines of code. And this is just to get you started:
#!/usr/bin/perl -w use strict; use warnings;

Both use warnings and -w isn't needed, see: What's wrong with -w and $^W

Personally I prefer the shebang #!/usr/bin/env perl to say "use whatever perl is in my PATH" (see env), it'll also work better with e.g. perlbrew. Pointing to a specific perl binary makes sense if distributing a script to a system where you may not have control over the PATH (e.g. CGI scripts on hosting providers).

Update: I agree with Tux's reply: In the case of the shebang, TIMTOWTDI.

Replies are listed 'Best First'.
Re^3: Please Help! This is a class assignment given to me.
by Tux (Canon) on Dec 07, 2019 at 10:08 UTC
    Pointing to a specific perl binary makes sense if distributing a script to a system where you may not have control over the PATH.

    Or if you want to make sure it uses a specific (non system) perl install that has modules installed that are not available in general distributions or have libraries linked that are specific to the script or …

    Personally I always use #!/pro/bin/perl, which is where I have my production perl installed. If I do not need anything specific, and system-perl will do (which is seldom the case), I make /pro/bin/perl a symlink to the required perl. TIMTOWTDI


    Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-19 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found