• Your Cart is Empty
  • Cart
  • Log In

Perl (programming language)

The web is the busiest place we know today, with millions of websites now available online, competing to catch the users attention. Apart from the common marketing and search engine optimization techniques, one of the key weapons website owners use in fighting for their visitors attention is the name of their website - i.e. their domain.

The beginning of Perl

Back in 1987, Larry Wall, a NASA system administrator at the time, designed a simple programming language, intended to make report processing easier. As with all genius ideas, it didn't take long and very soon the new programming language gained huge popularity. In just several years, the programming language saw several new releases, and each release was severely modified by the huge Perl community. In 1991, Perl 4 was released and for a long time it was the top programming language for the creation of complex web applications. In 1994, the Perl base was completely re-written to form Perl 5, which until today remains the stable release version. The year 1995 marks the creation of the CPAN, which stands for Comprehensive Perl Archive Network. Today, the CPAN has the largest Perl modules collection with over 15 000 modules, written by more than 7 000 authors, with the numbers constantly increasing.

The Perl base

Perl has adopted many borrowings from other popular programming languages - awk, sed, Lisp, etc., but is most influenced by C - it is procedural in its nature, and uses variables, expressions, control structures and sub-routines. In Perl all variables are marked with a sigil, which is usually the dollar sign ("$"), but Perl has also introduced several other sigils for arrays ("@"), hashes ("%") and sub-routines ("&"). Typical for Perl is the use of regular expressions - regex.

A simple Perl script

#!/usr/local/bin/perl
#
#
print 'Hello world.';

The latest revisions of Perl are aimed towards the simplicity of the code. Larry Wall himself is a linguist and his main task is to make the Perl syntax easier to read and understand. For example, in the last Perl version, the above example can look like this:

#!/usr/local/bin/perl
#
#
say 'Hello, world!'

Perl Programming

Perl supports both procedural and object-oriented programming. Due to its open source and rich community of users, it is rapidly developing and gaining even higher popularity among developers of dynamic web applications and system administrators. Apart from its exceptional text processing features, Perl boasts support for third-party databases, such as Oracle, PostgreSQL, MySQL, etc. (quickly integrated through Perl's DBI package), and easily interfaces with external C/C++ libraries through XS or the SWIG software. Moreover, Perl can handle encrypted web data, including e-commerce transactions.

Mod_perl

Mod_perl allows a Perl interpreter to be embedded in the Apache web server. It speeds up the interpreting of each generated page (executed at the moment of opening) and the processing of the data with as much as 200%. The server load is reduced to minimum even when executing Perl scripts from the most heavily content laden websites.

Generating HTML files linked together in a slide show:

#!/usr/local/bin/perl
f ($#ARGV != 1) {
    print "usage: htmlslides base num\n";
    exit;

base = $ARGV[0];
num = $ARGV[1];
or ($i=1; $i <= $num; $i++) {
    open(HTML, ">$base$i.html");
    if($i==$num) {
        $next = 1;
    } else {
        $next = $i+1;
    }
    print HTML "<html>\n<head>\n<title>$base$i</title>\n
</head>\n<body>\n";
    print HTML "<a href=\"$base$next.html\"><img src=\"$base$i.jpg\"></a>\n";
    print HTML "</body>\n</html>\n";
    close(HTML);

Perl with NTC Hosting

NTC Hosting always aims to provide perfectly optimized solutions to its clients. This is why all our web hosting servers are optimized to support "the three P's" - Perl, Python and PHP. Perl support is included in all our hosting plans to allow you to build your desired website in your preferred programming language.