Difference between Perl and Shell Scripting
Perl is a programming language developed by Larry Wall in the late 1980s to assist him in administering UNIX operating system environments. Perl has since been ported to other operating systems such as Microsoft Windows and Linux. Perl is widely renowned for its ease of use, power and functionality. Perl is a language that is implemented on many different systems, but is very well suited to write scripts similar that that run by the shell.
Perl is loosely based on the powerful ‘C’ programming language developed by Dennis Ritchie of Bell Labs in the early 1970s. Perl is used today for a wide variety of tasks including CGI programming, system administration and is also a favorite of both computer security professionals and so called ‘hackers’. Perl is extraction report language i.e. it handles Regular Expressions
Perl has all features what the other programming languages have. It has OOPS, network programming. Perl is very best for its data processing capability. Because perl has a very rich of regular expression handling. All the regular expression which is possible in sed and awk is possible in Perl. That is the reason perl is becoming very popular now a days. Website Programming is also possible using Perl. Perl has lot of modules
Shell scripting is associated with the use of a variety of ‘shells’ such as the ‘Bourne Shell’ developed by Stephen Bourne, also of Bell Labs, the ‘Korn Shell’ developed by David Korn, again while at Bell Labs and other widely used shells such as the ubiquitous ‘BASH’ shell (Bourne Again SHell) included with virtually every open source operating system such as Linux, OpenBSD, FreeBSD and some closed source ones. Shell scripting has, to some degree, more recently come to be associated with ‘batch/cmd file’ programming in Windows environments.
Shell script is a script that is interpreted by the shell. For example, Windows has its shell that has it’s code, Unix systems have Bourne shell, C shell, etc. Shell script is set of commands with variuos options. Whatever you want to write in shell script is possible in perl but the only difference is it’s easy to maintain and write perl scripts then shell.
- Interpreted by appropriate shell binary
- Example : /bin/bash/, /bin/ksh/
- Unless if you use /bin/sh/ -> it acts as a symlink to the systems preferred shell
- Shell scripts usually used to call external programs (mv, find, sed)
- This means it is somewhat dependant on the environment that the script find
- Different systems will have different variants of these utilities which may exhibit different behaviour
- Compiled and interpreted by perl binary
- Example : /usr/bin/perl/
- Do useful work without depending on external processes
- Have a better chance of easy portability between disparate systems
- Depending on what you do, a better performance