Perl | Part 2

Perl | Part 2

Perl – The camel symbol

Perl is usually symbolized by a dromedary (Arabian camel) was the image chosen by the publisher O’Reilly for the cover of Programming Perl, which therefore acquired the name of the “Camel Book. O’Reilly owns of this symbol as a trademark, but he says he uses his legal rights only to protect the “integrity and impact of this symbol”. O’Reilly allows non-commercial use of the symbol, and offers Programming Republic of Perl logo and Powered by Perl buttons.

Perl Description

Perl is a general purpose programming language originally developed for text manipulation and now used for a wide range of tasks including system administration, web development, network programming, GUI development and more.

It is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal). Its main features are that it is easy to use, supports both structured programming and object-oriented programming and functional programming, has incorporated a powerful text-processing system and a large collection of available modules.

Perl Features

The structure of Perl derives broadly from C. Perl is an imperative language, with variables, expressions, assignments, blocks of code delimited by braces, control structures and subroutines.

Perl also takes features from shell programming. All variables are marked with a sign above (sigil). The sigil unambiguously identify variable names, allowing Perl to have a rich syntax. Notably, the sigil allow variables to be interpolated directly into strings (strings). As in the shell, Perl has many built-in functions for common tasks and to access system resources.

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.

In Perl 5, features were added to support complex data structures, first-class functions (closures as values) and a model of object-oriented programming. These include references, packages and implementation of class-based method and the introduction of variables of lexical scope, which made it easier to write robust code (along with the strict pragma). A major feature introduced in Perl 5 was the ability to package code as reusable modules. Larry Wall later stated that “the intent of the system Perl 5 module was to support the growth of Perl culture rather than the Perl core.”

All versions of Perl do automatic data typing and memory management. The interpreter knows the type and storage requirements of each object in the program allocates and frees space for them as needed. Style legal conversions are done automatically at run time, the illegal conversions are fatal errors.

Perl Design

The design of Perl can be understood as a response to three broad trends in the computer industry: reduction of hardware costs, increased labor costs and improvements in compiler technology. Many earlier computer languages like Fortran and C, were designed to make efficient use of expensive computer hardware. In contrast, Perl is designed to make efficient use of expensive computer programmers.

Perl has many features that ease the programmer’s task at the expense of some CPU and memory requirements greater. These include automatic memory management, dynamic data type, strings, lists and hashes, regular expressions and introspection eval () function.

Wall was trained as a linguist and the design of Perl is very much informed by linguistic principles. Examples include Huffman coding (common constructions should be short), good (the important information should come first) and a large collection of language primitives. Perl supports language constructs, so natural for humans are the reading and writing, even if they complicate the Perl interpreter.

Perl syntax reflects the idea that “things that are different should look different.” For example, scalars, arrays and hashes have different leading sigils. Array indices and hash keys use different kinds of braces. Strings and regular expressions have different standard delimiters. This approach can be contrasted with languages like Lisp, where the same S-expression construct and basic syntax is used for many different purposes.

Perl has features that support a variety of programming paradigms, including imperative, functional and object oriented. At the same time, Perl is not compelled to follow any particular paradigm, or force the programmer to choose among them.

There is a broad sense of practicality, in both the Perl language and community and culture that surround it. The preface to Programming Perl begins, “Perl is a language for getting your job done.” One consequence of this is that Perl is a language not ordered. It includes features if people use them, tolerates exceptions to its rules, and employs heuristics to resolve syntactical ambiguities. Because of the forgiving nature of the compiler, bugs can sometimes be difficult to find. Discussing the variant behavior of the functions in the list and scalar contexts, the perlfunc manual page (1) states “In general, they do what you want, unless you want consistency.”

Perl has several mottos that convey aspects of its design and use. One is There’s more than one way to do it (There are more than one way) (TMTOWTDI, usually pronounced ‘Tim Toady’). Others are “Perl: the Swiss Army chainsaw of programming languages” and “Limits inaccurate.” A preset goal of Perl is easy to do things easily and difficult tasks possible. A Perl also has been called “The tape of the Internet”.

Continued.

Sharing

Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.