Perl is a high-level, general-purpose, interpreted, dynamic programming language.
Perl is not officially an acronym, there are various backronyms in use, such as: Practical Extraction and Reporting 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. The latest major stable revision is 5.16, released in May 2012. Perl 6 is a complete redesign of the language, announced in 2000 and still under active development as of 2013.
Perl borrows features from other programming languages including C, shell scripting (sh), AWK, and sed. The language provides powerful text processing facilities without the arbitrary data-length limits of many contemporary Unix tools,facilitating easy manipulation of text files. Perl gained widespread popularity in the late 1990s as a CGI scripting language, in part due to its parsing abilities.
In addition to CGI, Perl is used for graphics programming, system administration, network programming, finance, bioinformatics, and other applications. Perl is nicknamed "the Swiss Army chainsaw of scripting languages" because of its flexibility and power, and possibly also because of its perceived "ugliness". In 1998, it was also referred to as the "duct tape that holds the Internet together", in reference to its ubiquity and perceived inelegance.
Perl available in linux.
For Windows:
Users of Microsoft Windows typically install one of the native binary distributions of Perl for Win32, most commonly Strawberry Perl or ActivePerl. Compiling Perl from source code under Windows is possible, but most installations lack the requisite C compiler and build tools. This also makes it difficult to install modules from the CPAN, particularly those that are partially written in C.
ActivePerl is a closed source distribution from ActiveState that has regular releases that track the core Perl releases. The distribution also includes the Perl package manager (PPM), a popular tool for installing, removing, upgrading, and managing the use of common Perl modules.
Strawberry Perl is an open source distribution for Windows. It has had regular, quarterly releases since January 2008, including new modules as feedback and requests come in. Strawberry Perl aims to be able to install modules like standard Perl distributions on other platforms, including compiling XS modules.
The Cygwin emulation layer is another way of running Perl under Windows. Cygwin provides a Unix-like environment on Windows, and both Perl and CPAN are available as standard pre-compiled packages in the Cygwin setup program. Because Cygwin also includes the gcc, compiling Perl from source is also possible.
Sample Program For Multiplication:
use strict;
use warnings;
my $multi=$ARGV[0];
die "Multiplicant should be non zero integer\n" unless(($multi=~/^\d+$/)&&($multi ne 0));
die "Multiplier should be positive integer\n" unless(($ARGV[1]=~/^\d+$/)&&($ARGV[1]>0));
for(my $mult=1;$mult<=$ARGV[1];$mult++)
{
my $multiplication=$multi*$mult;
print "\n\t$multi"."\t*"."\t$mult"."="."\t$multiplication"."\n";
}
Run this in your cmd
perl multiplication.pl
Perl Module
A module defines its source code to be in a package , the Perl mechanism for defining namespace, e.g. CGI or Net::FTP or XML::Parser; the file structure mirrors the namespace structure (e.g. the source code for Net::FTP is in Net/FTP.pm). Furthermore, a module is the Perl equivalent of the class when Object Oriented Programming is employed.
A collection of modules, with accompanying documentation, build scripts, and usually a test suite, compose a distribution. The Perl community has a sizable library of distributions available for search and download via CPAN.
The language of Perl is defined by the single implementation (referred to as "perl") and is added to (and in rare occasions taken away from) each new release. For this reason it is important for a module author to be aware what features they're making use of and what the minimum required version of perl is. The code on this page requires perl 5.6.0 which is considered rather old by now.
No comments:
Post a Comment