in reply to Re^3: Why is lib/perl5 not added to INC for perls installed using perlbrew
in thread Why is lib/perl5 not added to INC for perls installed using perlbrew

"Such that I can have my scripts work seamlessly by just pointing the shebang to the perl bin. E.g. $PERLBREW_ROOT/perls/perl-5.32.0/bin/perl in this case."

I start all of my scripts with the following shebang. This includes those I write for myself, scripts I post here, and those I write for work in a production environment.

#!/usr/bin/env perl

That may work for you also. See perlrun for more details about this.

— Ken

Replies are listed 'Best First'.
Re^5: Why is lib/perl5 not added to INC for perls installed using perlbrew
by tobyink (Canon) on Sep 14, 2020 at 08:21 UTC

    Yep, this is what I do too, and it means that the script will just run under whatever version of Perl I've most recently selected in Perlbrew. That's usually what I want.

Re^5: Why is lib/perl5 not added to INC for perls installed using perlbrew
by afoken (Chancellor) on Sep 14, 2020 at 13:03 UTC

    I start all of my scripts with the following shebang. [...]

    #!/usr/bin/env perl

    Digging into the details, this starts the env program, which then searches for the first perl executable in $ENV{PATH}. So this increases the startup time slightly. Also, env is not always in /usr/bin. Some Linux distributions put it into /bin and add a symlink in /usr/bin. Some other Unixes have env only in /bin, with no symlink in /usr/bin. In that case, all of your scripts will simply fail. See also far more you ever wanted to know about #!.

    Alexander

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