CGI Perl Vs. PHP

by admin on January 26, 2012 · 0 comments

CGI Perl Vs. PHP

CGI Perl Vs. PHPthumbnail

Instructions:

Perl History

Larry Wall created Perl as a tool to simplify the creation and processing of reports under the UNIX operating system environment. The name Perl was originally a contraction of the word Pearl. Today, the name has become an acronym for "Practical Extraction and Report Language." The language has grown to include all the features you would expect in a modern programming language. Perl is often used to write short and simple scripts. Perl code is interpreted language rather than compiled. Perl has dynamic rather than static variable typing like C++ or Java. Recent versions of Perl even support object-oriented programming. You can find versions of Perl running on Linux, Windows, Mac OS X and other UNIX-like systems.

Perl CGI Applications

Perl interpreters are a standard component on many UNIX, Linux and BSD Web servers. This has helped make Perl a widely used CGI language. While some Web servers support Perl scripts embedded within Web pages, the majority of Perl scripts are files stored on a server that are loaded by the Web server and executed by the language interpreter. According to the website, "Perl Web Development," Movable Type, Bugzilla and cPanel, Amazon, Priceline Craigslist, IMDb, LiveJournal, Slashdot and Ticketmaster are examples of Web applications built using Perl scripts.

PHP History

Rasmus Lerdorf invented the PHP programming language as a tool to help him maintain his personal website. In fact, according to an article on the official PHP website, Ledorf called his language "Personal Home Page Tools." Today, PHP stands for "PHP: Hypertext Preprocessor." PHP was gradually grown to include access to multiple databases, embedding within HTML or HyperText Markup Language code, multiple operating system support, HTTP sessions, performance-enhancing output buffering, regular expressions and object-oriented programming. Like Perl, PHP is an interpreted language with dynamic data typing.

PHP CGI Applications

PHP code is usually embedded in Web pages, but like Perl, PHP scripts can be run as files stored on a server. You can write PHP CGI scripts to process Web forms, perform text transformations, read and write files, perform mathematical calculations and access Web server and operating system details. WordPress blogs, Facebook, Joomla and Drupal websites and Wikipedia are all programmed using PHP.

Similarities and Differences

While Perl and PHP CGI scripts are generally used for same Web programming chores, they are very different looking languages. Perl code closely resembles scripts written to use UNIX text processing utilities such as sed and AWK. PHP code and coding syntax, however, will be quite familiar to C or C++ programmers. Both Perl and PHP are supported by large communities that freely share code and documentation. Perl programmers can access CPAN or the Comprehensive Perl Archive Network for Perl modules they can use in their scripts. PHP programmers have a comparable code repository in PECL or the PHP Extension Community Library.

Previous post:

Next post: