Op 02-07-17 om 10:52 schreef Lars Noodén:
I've grepped the first lines of a large project's source files for
instances of the string perl as a word. Sorted, ranked, and slightly
edited, the results can be seen below. What I am wondering is that can
anything general, independent of context be said about the invocations?
For example, is the 'use warnings;' pragma better than launching with
-w? Same for launching perl via '#!/usr/bin/env perl' rather than
'#!/usr/bin/perl' instead? What about a leading whitespace like with
'#! /usr/bin/perl' instead of '#!/usr/bin/perl' ?
Regards,
Lars
493 #!/usr/bin/perl -w
492 #!./perl
288 #!/usr/bin/perl
166 #!./perl -w
8<
Hi Lars,
(My excuses for answering off list, I clicked the wrong button...)
Lots of questions are answered in the documentation that comes with Perl.
When you type 'perldoc perlintro' the third paragraph 'Running Perl
programs' instructs you how
to invoke perl in a script.
It also points you to 'perldoc perlrun' for in depth information on the
subject.
What it boils down to: use warnings as well as -w works, but -w is
considered old fashioned.
A space in the perlbang (shebang) line is not perls problem but your
shell's. I would NOT use a space.
If your shell doesn't choke on such a space: lucky you.
When you have only one Perl, #!/usr/bin/env perl and #!/usr/bin/perl
have the same effect.
However, when you use perlbrew, which I recommend for development
purposes, you should use
#!/usr/bin/env. In production using env is considered dangerous by some,
because you have less
controll over which Perl is invoked.
Apart from the perldocs also have a look at https://perlmaven.com/hashbang
A great source of information for beginners.
Greetings,
Eric de Hont
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/