shebang in perl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prakashspatil
    New Member
    • Oct 2006
    • 7

    shebang in perl

    what is shebang line in perl
    how it executes even as it starts with comment (#).
  • miller
    Recognized Expert Top Contributor
    • Oct 2006
    • 1086

    #2
    Code:
    #!/usr/bin/perl
    The "shebang" line in a perl script is not perl, but instead a shell directive. It tells your shell to pipe the contents of this file to this executable when this script is executed. #! is just the syntax that is required to indicate this.

    Alternatively you could pipe the contents to python or any other binary. Also your perl script doesn't have to end in .pl. It just makes it easier for us to know what it is when so named.

    Unless of course you're in a windows environment, in which case the shebang is ignored and the file is executed based off of filetype associations, in which case the .pl is important.

    Comment

    • prakashspatil
      New Member
      • Oct 2006
      • 7

      #3
      Originally posted by miller
      Code:
      #!/usr/bin/perl
      The "shebang" line in a perl script is not perl, but instead a shell directive. It tells your shell to pipe the contents of this file to this executable when this script is executed. #! is just the syntax that is required to indicate this.

      Alternatively you could pipe the contents to python or any other binary. Also your perl script doesn't have to end in .pl. It just makes it easier for us to know what it is when so named.

      Unless of course you're in a windows environment, in which case the shebang is ignored and the file is executed based off of filetype associations, in which case the .pl is important.
      Miller Thank you so much I got my answer

      Comment

      Working...