Brief Introduction of Perl
- Posted by Tim Hsueh on July 29th, 2010 filed in SQA - Advice Center
- Comment now »
In this blog, one of the most used web languages Perl will be discussed in detail including the features, code samples and the well known companies who are using it.
- Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular amongst programmers. Larry Wall continues to oversee development of the core language, and its upcoming version, Perl 6.
- The Features of Perl
The overall structure of Perl derives broadly from C. Perl is procedural in nature, with variables, expressions, assignment statements, brace-delimited blocks, control structures, and subroutines.
Perl also takes features from shell programming. All variables are marked with leading sigils, which unambiguously identify the data type of the variable in context. Importantly, sigils allow variables to be interpolated directly into strings. Perl has many built-in functions that provide tools often used in shell programming such as sorting, and calling on system facilities.
Perl takes lists from Lisp, associative arrays (hashes) from AWK, and regular expressions from sed. These simplify and facilitate many parsing, text-handling, and data-management tasks.
Perl 5 added features that support complex data structures, first-class functions, and an object-oriented programming model. These include references, packages, class-based method dispatch, and lexically scoped variables, along with compiler directives. A major additional feature introduced with Perl 5 was the ability to package code as reusable modules.
All versions of Perl do automatic data-typing and automatic memory-management. The interpreter knows the type and storage requirements of every data object in the program; it allocates and frees storage for them as necessary using reference counting. Legal type-conversions — for example, conversions from number to string — are done automatically at run time; illegal type conversions are fatal errors
- The code samples of Perl
In Perl, the minimal Hello world program may be written as follows:
print “Hello, world!\n”;
An array value (or list) is specified by listing its elements, separated by commas, enclosed by parentheses (at least where required by operator precedence).
@scores = (32, 45, 16, 5);
The qw() quote-like operator allows the definition of a list of strings without typing of quotes and commas. Almost any delimiter can be used instead of parentheses. The following lines are equivalent:
@names = (‘Billy’, ‘Joe’, ‘Jim-Bob’);
@names = qw(Billy Joe Jim-Bob);
The split function returns a list of strings, which are split from a string expression using a delimiter string or regular expression.
@scores = split(‘,’, ‘32,45,16,5′);
- Well known companies who are using Perl
International Companies: Nokia and Opera Software.
U.S. Companies: Apple, Amazon, Google and Yahoo.
Leave a Comment