|Pathologically Eclectic Rubbish Lister|
Perl advocacyby tinman (Curate)
|on Jun 16, 2001 at 00:42 UTC||Need Help??|
Recently, I was asked to write a position paper of sorts for a company that was interested in using Perl as a development language. The local universities have nothing to do with Perl, and its generally only known by a few Unix admins and webmasters...so, finding and training people would also be a factor in adopting Perl (all the universities teach Java and bits of C as standard)...
Of course, Perlmonks was a good place to start looking, and I wrote the following document...
Why Perl over Java
What is Perl
Perl is an open source cross platform scripting language.(http://www.perl.com). Originally designed and written in 1987 (http://www.perl.org/press/history.html) as a powerful replacement for Unix shell scripting languages such as sed and awk, Perl is now widely used (http://perl.oreilly.com/news/success_stories.html) in many different organizations and many different spheres of computing activity. Text processing and data analysis, as well as CGI scripting are domains which have been dominated by Perl in recent years.
Now in release 5.6.1, Perl is developed by a group of volunteers, with several commercial organizations (www.activestate.com being the main player) actively aiding and abetting. Documentation and literature for Perl is widely available on the Internet and in downloadable form. Perl itself is freely distributed in both source form and as binaries for many different operating systems (http://www.perl.com/reference/query.cgi?binaries), including Unix (Solaris, AIX, BSD variants, HP-UX), MacOS, Win32, Irix, VMS, BeOS, OS/2 etc.
They're both freely available for download and use. (However, Perl is open source, Java is not.) They are both cross platform, however Perl itself is more stable on a larger number of platforms (personal experience: Java on Linux isn't very stable, although there is improvement esp. with 1.3SE. Perl on Linux is a commonly used webserver platform). Perl and Java both have garbage collection and dynamic memory allocation. Java and Perl both allow object oriented programming, although Perl can also be programmed in functional or procedural styles.
Perl and Java both have similar toolkits for most common tasks, such as database access (JDBC for Java, DBI for Perl).
Regular expressions: Perl pioneered incorporating regular expressions into a language. Since Perl, other languages such as Python, PHP and even Java (from 1.4 onwards) use regexps for text matching. However, the re engine in Perl is far more sophisticated. for example: the Rx cookbook (http://aspn.activestate.com/ASPN/Cookbook/Rx)
Update 2: Blew away the regexp per Ovid's comment.. Yes, absolutely right.. It took lots of dissecting before I got it..
Speed of development Generally fewer lines of code per task than C, C++ or Java.. an often quoted metric is 3 lines of Java code per line of Perl code.
builds a list which contains all characters from A to Z and all digits from 0 to 9 A complete perl script which builds the list and prints a random 15 character registration key. Comments denoted with a #
Update 1: Fixed the example. If you want to see the wrong way, read btrott's node :o)
Public module repositories (CPAN): Modules for almost anything that can be done with Perl database drivers, XML parsing modules (DOM, SAX), SOAP related modules, credit card authorization modules, weather modules, user interfaces (Tk) etc http://search.cpan.org/ for a list of categories
Some Perl vs Java related resources
High traffic sites that use Perl (see http://perl.oreilly.com/news/success_stories.html)
I somehow am not very satisfied with the way it turned out (although I've already submitted a first draft).. Particularly, any other high traffic sites that use Perl (a perlmonks link mentioned Amazon, eToys etc, so I didn't repeat those).. any other key differentiators between Perl and Java ? (apologies, but Java is the language that they know, and they wanted a comparison)
Please note that I am not looking to start a flamewar here. I feel there aren't enough software companies that really take Perl seriously (where I come from, anyway), and I want to increase awareness, in a small way... any critiques or additions to the stuff above appreciated, and gratefully accepted...
Besides, this gathers all the Perl advocacy that I could find in one place... It'll be a useful point of reference, at the very least :o)