What should I use for a Perl script's shebang line?

后端 未结 8 1858
北荒
北荒 2020-12-02 22:19

Which of these is better or faster to use as the shebang line for a Perl script?

#! perl

#! perl.exe

#! fullpath/perl(/perl.exe)

#! partialpath/perl(/perl         


        
8条回答
  •  不知归路
    2020-12-02 22:42

    The first line stands for shebang. It basically tells the program where Perl interpreter is located since Perl is interpreted language. On Linux you can type in terminal:

    whereis perl
    

    which will give you exact location of it. Usually it's inside /usr/bin/perl. This means that you want to make shebang regarding to /usr/bin/perl

    #! /usr/bin/perl
    
    use strict;
    use warnings;
    use v5.10.1;
    .
    .
    .
    

    This is just some good practice, hence it's obviously fastest solution.

    I hope you find this useful,

    Thanks.

提交回复
热议问题