LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-12-2004, 11:33 PM   #1
Echo Kilo
Member
 
Registered: Jul 2004
Distribution: Ubuntu - Debian Based
Posts: 242

Rep: Reputation: 30
Perl


Is it accurate to say, the line #!/usr/bin/perl is a command to the Perl program?

Is this considered a perl directive like a shell directive or is it something else in perl?
 
Old 12-13-2004, 01:18 AM   #2
rhoekstra
Member
 
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 372

Rep: Reputation: 42
That line has nothing to do with perl itself..

It is the first line of an executable file (the x-bit), and tells the kernel / shell what interpreter is needed to process the file..

It could be like
'#!/bin/bash' for a bash script,
'#!/bin/sh' for a shell script,
'#!/bin/awk' for an awk script,
'#!/usr/bin/perl' for perl, etc. etc...

You leave out this line and bash (or your shell) won't know how to interpret the file, and will try to do so itself, causing all kinds of errors.

Alternative to using above line would be to call 'perl <filename>' to explicitly tell perl to process the file <filename>.

Hope this helps..
 
Old 12-13-2004, 01:34 PM   #3
ogmoid
Member
 
Registered: Jul 2004
Location: Coeur d'Alene Idaho
Distribution: Slackware
Posts: 41

Rep: Reputation: 15
[FYI] That first line is most commonly known as the "shebang line".
 
Old 12-13-2004, 01:37 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
i don't think "most commonly" is really right. i reckon it's more common to call it "that thingy at the start" or something. also often called a "hashbang"
 
Old 12-13-2004, 01:45 PM   #5
ogmoid
Member
 
Registered: Jul 2004
Location: Coeur d'Alene Idaho
Distribution: Slackware
Posts: 41

Rep: Reputation: 15
Quote:
Originally posted by acid_kewpie
i don't think "most commonly" is really right. i reckon it's more common to call it "that thingy at the start" or something. also often called a "hashbang"
Good point. "hashbang", or "shebang" will probably lead you quickest to info on what it is and how to use it.
 
Old 12-14-2004, 01:07 AM   #6
rhoekstra
Member
 
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 372

Rep: Reputation: 42
I knew there was a name for it I couldn't recall.... thanks!
 
Old 12-14-2004, 04:11 AM   #7
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
I alays call it "hash ping"

billy
 
Old 12-14-2004, 05:41 AM   #8
mayur
LQ Newbie
 
Registered: Jun 2003
Posts: 14

Rep: Reputation: 0
If you don't know the path of perl do,
which perl
/usr/bin/perl
#!<name of interperter program> don't take first # as comment.
so give, #!/usr/bin/perl this in your .pl file
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with perl module for w3c validator to work on my local Apache+PHP+perl instal tbamt Linux - Software 0 12-16-2004 05:37 PM
cgi perl : I cant get perl to append my html file... the_y_man Programming 3 03-22-2004 05:07 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM
chrooting apache v2 (php, ssl, perl support) ; perl configuration markus1982 Linux - Security 3 01-26-2003 06:15 PM
can i set ~/public_html/perl as a perl directory for apache? doublefailure Linux - Networking 1 07-09-2002 04:31 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration