On Fri, 29 Oct 2004, Durai raj wrote:

>   Anyone can explain the difference between Perl and Shell scripts?

They're completely separate languages.

On Unix systems, a "shell" is a program that receives input and sends 
results down to the kernel to be executed, thus the name "shell" -- it's 
an easier way to work than trying to talk to the kernel directly. Common 
shells include bash, ksh, zsh, tcsh, csh, and sh. The last one is called 
the Bourne shell; it is the original and most others resemble it. A 
series of shell statements that could otherwise be run directly at the 
command line prompt can also be saved as a shell script and run that 
way, much like a DOS batch script. These scripts are typically written 
in the Bourne shell (sh), because that's the one most likely to be 
installed on any given Unix system, but shell scripts can be written in 
any shell language. People will look at you funny if you write them 
using the csh shell, but even that one can be used :-)

On the other hand, Perl is a programming language that was designed with 
ideas from many places, including the different Unix shells, languages 
like C, Basic & Lisp, and Unix system commands like Sed and Awk. A lot 
of Perl's core functions look and act like well known shell commands -- 
grep, chmod, etc -- but this is only to help make Perl easy to learn for 
someone already familiar with those commands. 

Perl is separate from the Unix shells. You can have some overlap -- a 
shell script can make use of all sorts of programs, including perl, and 
a Perl script can run shell commands with system( ... ) or `...` -- but 
in general, well written shell scripts don't need Perl and well written 
Perl scripts don't need external shell commands. 

Clearer?


-- 
Chris Devers      [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to