http://www.perlmonks.org?node_id=88932

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...

<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.

What Perl and Java have in common

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).

Perl - Key differentiators

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.

@elements = ('A'..'Z', 0..9);
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 #
#!/usr/bin/perl -w use strict; my @elements = ('A'..'Z', 0..9); my $regkey = join '', map { $elements[ rand @elements ] } 1..15;

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
http://perlmonks.org/index.pl?node_id=33185
http://www-106.ibm.com/developerworks/library/l-p560.html?l=16jn3
http://perlmonks.org/index.pl?node_id=68860
http://perlmonks.org/index.pl?node_id=44324
http://perlmonks.org/index.pl?node_id=72994
http://www.perl.org/phbs/
http://www.perl.org/phbs/reduce-risks.html
http://perlmonks.org/index.pl?node_id=66959
http://www.nectec.or.th/net-guide/Perl/faq/1.29.html

High traffic sites that use Perl (see http://perl.oreilly.com/news/success_stories.html)
http://www.slashdot.org
http://www.perlmonks.org
Quoting directly from this node,
"www.Etoys.com is all Perl. Deja is all Perl. http://www.Amazon.com uses Perl for nearly all their backend operations. Yahoo is mostly Perl behind the scenes. Altavista is all Perl, except for the purchased software. Sportsline.CBS.com is "80% Perl". "
</document>

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)