phildeman has asked for the wisdom of the Perl Monks concerning the following question:

Would anyone know what the following does or means? It is at the top of a script that I was asked to work on.

#!/usr/local/bin/perl -- -*- C -*-

Thanks.

Replies are listed 'Best First'.
Re: Unusual Call to perl at top of Script
by MidLifeXis (Monsignor) on Sep 02, 2015 at 15:16 UTC

    The -- indicates that this is the end of parameters to perl, and the -*- XYZ -*- is an indicator to some editors that it should use XYZ language semantics when dealing with the file.

    Update: I agree with the "dreadful" comment above. Put it on the second line or in a file variables section in the file.

    Update: I would also suggest, since these are perl files, that you use perl or cperl instead of C.

    --MidLifeXis

Re: Unusual Call to perl at top of Script
by toolic (Bishop) on Sep 02, 2015 at 14:28 UTC
Re: Unusual Call to perl at top of Script
by Yary (Pilgrim) on Sep 02, 2015 at 15:16 UTC
    The "--" arg on a command line says that any following arguments are a filename and perhaps @ARGV options for the perl code, useful when running a file that starts with a dash, or for giving options to a one-liner. When it's in the shebang line, it prevents anything that follows it from being used, effectively commenting out the rest of the shebang line.
Re: Unusual Call to perl at top of Script
by Anonymous Monk on Sep 02, 2015 at 15:09 UTC
    And, a perfectly dreadful and inappropriate thing to be doing in a shebang. Fix it ...

      And, a perfectly dreadful and inappropriate thing to be doing in a shebang. Fix it ...

      Nonsense