473,505 Members | 13,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

shebang in perl

7 New Member
what is shebang line in perl
how it executes even as it starts with comment (#).
Oct 31 '06 #1
2 2928
miller
1,089 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. #!/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.
Oct 31 '06 #2
prakashspatil
7 New Member
Expand|Select|Wrap|Line Numbers
  1. #!/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
Nov 1 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
9186
by: deko | last post by:
In regard to running php scripts with cron - Here is a sample script: <?php //debug.php echo "<br> This is a test"; ?> I can call debug.php from a web page on my site like this:
0
1337
by: Andres Corrada-Emmanuel | last post by:
Hello, Does the optimize flag work on the shebang line of UNIX systems? I've tried to execute a script on a Solaris system with a shebang line of the form: #! /usr/bin/env python -O and it...
5
2361
by: rbt | last post by:
Haven't tested this on Windows yet... thought I'd ask here: Does the line below have any negative impact on Windows machines? I develop and test mostly on Unix, but my scripts are often used on...
11
2299
by: Joerg Schuster | last post by:
Hello, is there a way to compile a python file foo.py to foo.pyc (or foo.pyo) such that foo.pyc can be run with 'foo.pyc' (as opposed to 'python foo.pyc') on the command line? Jörg Schuster
0
9734
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
5
1302
by: veracon | last post by:
Long story short, in order to use Python 2.5, I've compiled it in my own account on my hosting. It works fantastic as /home/my_username/python2.5, but the shebang is a bit long. Is there a way to...
13
4459
by: Chris Lasher | last post by:
Should a Python module not intended to be executed have shebang/ hashbang (e.g., "#!/usr/bin/env python") or not? I'm used to having a shebang in every .py file but I recently heard someone argue...
12
6114
by: patelxxx | last post by:
I've tried the following and unable to run the CGI script: #!c:/program files/perl/perl #!/usr/bin/perl #!C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/ thank you
1
3960
by: dxz | last post by:
I have a perl script to run on both UNIX and Windows. How should I write the Shabang line: On UNIX, it is #!/usr/bin/perl On Windows, it is #!C:\perl\bin\perl.exe Which one should I use?...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.