What is the difference between a perl program and a shell script? Which out of these is easier to understand and execute? And How?

Showing Answers 1 - 5 of 5 Answers

subbu malepati

  • Sep 3rd, 2006
 

Hi,Perl is similar to C language. It is rich in functions.The syntax in perl is same as in C, each stmnt should be ended with ";" semicolon.Perl is extraction report language, mean to say that it handles Regular Expressions! .Shell script is set of commands with variuos options. regardssubbu malepatiBlore.

  Was this answer useful?  Yes

Sunil Kartikey

  • Sep 15th, 2006
 

Whatever you want to write in shell script is possible in perl..the only diff is its easy to maintain and write perl scripts then shell.. lots of module etc are available for perl... u not need to rit everything frm scratch...also since earlier all the scripts are used to be written in shell now its required to maintain those thing.. no body want to touch it again which is working for years.. and its very tough too to port it in perl..i would suggest atleast frm now use perl on place of perl :)

  Was this answer useful?  Yes

ayush sharma

  • Oct 10th, 2006
 

Yes exactly, Perl gives you an extended advantages of having enormous library in the form of modules [see www.cpan.org]. Also, from my personal experience i can say, use shell script when the functionality needed is less and Perl when you want to do a little higher level of processing.Consider this: You just want to read a file [no processing] & grep for some thing. In shell script it is as simple as sh > cat FileName | grep $contentWhereas this can take a lot of time in perl [open function call etc etc] Whereas if you want to read a database table and then create XML out of it, i am sure u'll have a tough-time writing that in shell script. But perl on the other hand gives you modules that can make this quite easy ;)my 2 cents,Ayush Sharma

rahulashu

  • Jun 10th, 2008
 

if  the  number  of  functionality is no  more then we  can go for  the unix  but  if  u are  working  for  database  connectivity and  other  related work with database  then  i will  prefer a  perl  lang.

  Was this answer useful?  Yes

sandeep

  • Oct 23rd, 2015
 

Are you sure that its necessary to provide semicolon.
Because I have tried it and it works without them also.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions