Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Perl interpretation of weird #! line

by jesuashok (Curate)
on Jan 09, 2006 at 06:51 UTC ( #521861=perlquestion: print w/replies, xml ) Need Help??
jesuashok has asked for the wisdom of the Perl Monks concerning the following question:

Hi all Gr8 People,


I saw a above line in one of perl source code which is Very new to me since I am working in Perl only in Unix and linux.

what does that line mean ?
what does it day to perl interpreter ?
Is the above line specific to any Os dependant ?

Please provide me your Valuable points which will help me and others a lot.

"Keep pouring your ideas"

2006-01-09 Retitled by broquaint, as per Monastery guidelines
Original title: 'Perl Interpration'

2006-01-10 Edited by planetscape - fixed formatting/markup

Replies are listed 'Best First'.
Re: Perl interpretation of weird #! line
by davorg (Chancellor) on Jan 09, 2006 at 09:48 UTC

    I strongly suspect that is a template variable that will be expanded to a real Perl path as part of the process which puts the program into production.


    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: Perl interpretation of weird #! line
by rinceWind (Monsignor) on Jan 09, 2006 at 11:48 UTC

    As others have said, what you have is a shebang line for a script that has not yet been deployed.

    What is to the right of the #! has no effect on Windows systems, as these find perl using a file type association, or the script gets turned into a .bat file with a different preamble. If the line could be parsed into a perl command and options, e.g. -w these options would be applied.

    Unix systems expect to see the full path to perl. Sometimes #!perl will work via $ENV{PATH}, but this is considered unreliable and insecure.

    The standard script installing mechanism used by ExtUtils::MakeMaker invokes MY->fixin over each script. This will cause your placeholder shebang line to be replaced with a real one that has a path to perl. The fixin method does different things depending on your platform, for example it runs pl2bat on Windows.

    On Unix, fixin does the following:

    • Extract the command and any arguments

    • If the command is the string 'perl' get the interpreter path from $Config{startperl}.

    • Else if there was a different command parsed out, use $Config{perlpath}

    • Otherwise, try and find the perl executable by looking in the path.


    Oh Lord, won’t you burn me a Knoppix CD ?
    My friends all rate Windows, I must disagree.
    Your powers of persuasion will set them all free,
    So oh Lord, won’t you burn me a Knoppix CD ?
    (Missquoting Janis Joplin)

Re: Perl interpretation of weird #! line
by blazar (Canon) on Jan 09, 2006 at 08:32 UTC
    To build on Ultra's reply, it may be a directive for a text editor. For example my editor, JED, opens in perl mode based on extension (.pl) and/or shebang line. But for my modules I did not set up an association. I always put a
    # -*- Perl -*-
    comment at the top of them instead.
Re: Perl interpretation of weird #! line
by Ultra (Hermit) on Jan 09, 2006 at 07:16 UTC

    Was that line the first line of a Perl program?

    If that's the case, then the kernel should run what is after the shebang,meaning '@@PERL@@' which I think is an error.

    If not, it is just a comment.

    Dodge This!
      Perl will process any options it finds after the word "perl" on the shebang line. I believe this is case insensitive. So #!@@PERL@@ -w (for example) as the first line of the program should turn on warnings.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://521861]
Approved by neversaint
[erix]: "code of someone that died" -- kinda nice if your code stops working too
[erix]: hard to implement, hmm
[Corion]: erix: Well, they also seem to have changed the server, or some software, or whatever, and seem to be in the process of changing the DB schema from having the "username" as primary key to something else.
[Corion]: Far too many things being done at once, or maybe only now has it become apparent that nobody knows that piece of software anymore
[marto]: good morning all
[Corion]: I consider having an abstract key as userid in your system good, because the "real" company-wide (or even larger) user id will likely not fit your criteria well
[Corion]: A good morning marto!

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2017-01-23 09:35 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (192 votes). Check out past polls.