Why don't I get any syntax errors when I execute my Python script with Perl?

后端 未结 1 1535
栀梦
栀梦 2020-12-05 09:26

I just wrote some testing python code into test.py, and I\'m launching it as follows:

perl test.py

After a while I realized my

相关标签:
1条回答
  • 2020-12-05 09:56

    From perlrun,

    If the #! line does not contain the word "perl" nor the word "indir" the program named after the #! is executed instead of the Perl interpreter. This is slightly bizarre, but it helps people on machines that don't do #! , because they can tell a program that their SHELL is /usr/bin/perl, and Perl will then dispatch the program to the correct interpreter for them.

    For example,

    $ cat a
    #!/bin/cat
    meow
    
    $ perl a
    #!/bin/cat
    meow
    
    0 讨论(0)
提交回复
热议问题