in reply to Difference between a perl script & shell script
I don't know what exactly you are looking for, the basic difference is that shell script will be interpreted by the appropriate shell binary (for example /bin/bash, /bin/ksh), whereas the perl script will be compiled and interpreted by the perl binary (e.g. /usr/bin/perl).
One practical difference is that the shell comes in a variety of flavours and you can never know which shell binary will be executed on a system your shell script gets copied to. Usually shell scripts call /bin/sh , which on many systems is just a symlink to the systems preferred shell. While it is usually not extraordinarily difficult to write shell scripts which are portable between different shell flavours, this does require some knowledge and diligence on the part of the script author. A perl script will always run in perl, which is mostly the same across *NIX systems, so you do not need to worry about incompatibilities between different systems as much (as long as you take care that your script works under the commonly installed version of perl, and not just the most recent one). Thus, for certain usage scenarios, Perl scripts are more portable between systems than shell scripts.
Another practical difference is that the shell on it's own doesn't do very much, shell scripts are usually used to call external programs (mv,find,ls,sed to name a few). So again you are somewhat dependant on the environment that your script find, because different systems will have different variants of these utilities installed which may exhibit different behaviour. A lot of Perl scripts OTOH do useful work without depending on external processes, so again you have a better chance of easy portability between disparate systems and, depending on what you do, better performance.
A good answer to your question really depends on why you're asking it :-)
|
|---|