I'd personally avoid hard-coding a path to perl in the shebang line. [...] This allows you to change the version of Perl in the current environment and run your script under this new version. In particular, it's useful when testing how your script runs under different versions of Perl

The shebang line with a fixed interpreter does not prevent you from trying other interpreters:

./foobar.pl # <- perl from shebang perl foobar.pl # <- whatever perl is found first in $ENV{'PATH'} /home/me/bin/perl-special foobar.pl # <- a special perl /usr/local/bin/perl foobar.pl # <- common location for a local perl /usr/bin/perl foobar.pl # <- common location for system perl

perlrun has an entire chapter "Location of Perl" with recommendations:

Perl has some surprises when it comes to the shebang line, see perlrun:

Also, while most systems have /usr/bin/env, not all systems have it. Some have the env utility in /bin/env. Some systems use a symlink in one directory pointing to env in the other directory. See also http://www.in-ulm.de/~mascheck/various/shebang/#env.

env is another process that has to be started. env does not just start perl; at least, it has to parse the command line for arguments. See busybox env.c for a quite minimal implementation. Entry point is env_main(). The GNU version does much more, see GNU env.c. So using env in the #! line increases the startup time. Generally, it does not matter that much, especially on modern machines. But the overhead is not zero.

I typically start my scripts like this:
#!/usr/bin/env perl use 5.014; use strict; use warnings;

use strict is redundant here, as use VERSION with a VERSION >= 5.12.0 implies use strict. See use.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re^2: Please critique this script -- Read emails and write URLs into bookmarks by afoken
in thread Please critique this script -- Read emails and write URLs into bookmarks by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.