{"id":1340,"date":"2021-06-15T06:47:44","date_gmt":"2021-06-15T06:47:44","guid":{"rendered":"https:\/\/blog.amt.in\/?p=1340"},"modified":"2021-06-15T06:47:44","modified_gmt":"2021-06-15T06:47:44","slug":"introduction-to-perl","status":"publish","type":"post","link":"https:\/\/blog.amt.in\/index.php\/2021\/06\/15\/introduction-to-perl\/","title":{"rendered":"Introduction to Perl"},"content":{"rendered":"<p>Perl\u00c2\u00a0is a family of two\u00c2\u00a0high-level,\u00c2\u00a0general-purpose,\u00c2\u00a0interpreted,\u00c2\u00a0dynamic programming languages. &#8220;Perl&#8221; refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned &#8220;sister language&#8221;, Perl 6, before the latter&#8217;s name was officially changed to\u00c2\u00a0Raku\u00c2\u00a0in October 2019.<\/p>\n<p>Though Perl is not officially an acronym,\u00c2\u00a0there are various\u00c2\u00a0backronyms\u00c2\u00a0in use, including &#8220;Practical\u00c2\u00a0Extraction\u00c2\u00a0and Reporting Language&#8221;. Perl was originally developed by\u00c2\u00a0Larry Wall\u00c2\u00a0in 1987 as a general-purpose\u00c2\u00a0Unix\u00c2\u00a0scripting language\u00c2\u00a0to make report processing easier.\u00c2\u00a0Since then, it has undergone many changes and revisions. Raku, which began as a redesign of Perl 5 in 2000, eventually evolved into a separate language. Both languages continue to be developed independently by different development teams and liberally borrow ideas from each other.<\/p>\n<p>The Perl languages borrow features from other programming languages including\u00c2\u00a0C,\u00c2\u00a0shell script\u00c2\u00a0(sh),\u00c2\u00a0AWK, and\u00c2\u00a0sed;\u00c2\u00a0Wall also alludes to\u00c2\u00a0BASIC\u00c2\u00a0and\u00c2\u00a0Lisp\u00c2\u00a0in the introduction to\u00c2\u00a0Learning Perl\u00c2\u00a0(Schwartz &amp; Christiansen) and so on.\u00c2\u00a0They provide text processing facilities without the arbitrary data-length limits of many contemporary\u00c2\u00a0Unix command line tools,\u00c2\u00a0facilitating manipulation of\u00c2\u00a0text files. Perl 5 gained widespread popularity in the late 1990s as a\u00c2\u00a0CGI scripting\u00c2\u00a0language, in part due to its unsurpassed\u00c2\u00a0regular expression\u00c2\u00a0and\u00c2\u00a0string\u00c2\u00a0parsing\u00c2\u00a0abilities.<\/p>\n<p>In addition to CGI, Perl 5 is used for\u00c2\u00a0system administration,\u00c2\u00a0network programming, finance,\u00c2\u00a0bioinformatics, and other applications, such as for\u00c2\u00a0GUIs. It has been nicknamed &#8220;the Swiss Army chainsaw of scripting languages&#8221; because of its flexibility and power,\u00c2\u00a0and also its ugliness.\u00c2\u00a0In 1998, it was also referred to as the &#8220;duct tape\u00c2\u00a0that holds the\u00c2\u00a0Internet\u00c2\u00a0together,&#8221; in reference to both its ubiquitous use as a\u00c2\u00a0glue language\u00c2\u00a0and its perceived inelegance.<\/p>\n<p>Perl is a highly\u00c2\u00a0expressive\u00c2\u00a0programming language: source code for a given algorithm can be short and highly compressible.<\/p>\n<p>Perl was originally named &#8220;Pearl&#8221;. Wall wanted to give the language a short name with positive connotations; he claims that he considered every three- and four-letter word in the dictionary. He also considered naming it after his wife Gloria. Wall discovered the existing\u00c2\u00a0PEARL\u00c2\u00a0programming language before Perl&#8217;s official release and changed the spelling of the name.<\/p>\n<p>When referring to the language, the name is normally capitalized (Perl) as a proper noun. When referring to the interpreter program itself, the name is often uncapitalized (perl) because most Unix-like file systems are case-sensitive. Before the release of the first edition of\u00c2\u00a0Programming Perl, it was common to refer to the language as\u00c2\u00a0perl;\u00c2\u00a0Randal L. Schwartz, however, capitalized the language&#8217;s name in the book to make it stand out better when typeset. This case distinction was subsequently documented as canonical.<sup id=\"cite_ref-capitalization_26-0\" class=\"reference\">[26]<\/sup><\/p>\n<p>The name is occasionally expanded as\u00c2\u00a0Practical Extraction and Report Language, but this is a\u00c2\u00a0backronym.<sup id=\"cite_ref-27\" class=\"reference\">[27]<\/sup>\u00c2\u00a0Other expansions have been suggested as equally canonical, including Wall&#8217;s own\u00c2\u00a0Pathologically Eclectic Rubbish Lister\u00c2\u00a0which is in the\u00c2\u00a0manual page\u00c2\u00a0for perl.\u00c2\u00a0Indeed, Wall claims that the name was intended to inspire many different expansions.<\/p>\n<p>The overall structure of Perl derives broadly from C. Perl is\u00c2\u00a0procedural\u00c2\u00a0in nature, with\u00c2\u00a0variables,\u00c2\u00a0expressions,\u00c2\u00a0assignment statements,\u00c2\u00a0brace-delimited\u00c2\u00a0blocks,\u00c2\u00a0control structures, and\u00c2\u00a0subroutines.<\/p>\n<p>Perl also takes features from shell programming. All variables are marked with leading\u00c2\u00a0sigils, which allow variables to be\u00c2\u00a0interpolated\u00c2\u00a0directly into\u00c2\u00a0strings. However, unlike the shell, Perl uses sigils on all accesses to variables, and unlike most other programming languages that use sigils, the sigil doesn&#8217;t denote the type of the variable but the type of the expression. So for example, while an array is denoted by the sigil &#8220;@&#8221; (for example\u00c2\u00a0<code>@arrayname<\/code>), an individual member of the array is denoted by the scalar sigil &#8220;$&#8221; (for example\u00c2\u00a0<code>$arrayname[3]<\/code>). Perl also has many built-in functions that provide tools often used in shell programming (although many of these tools are implemented by programs external to the shell) such as\u00c2\u00a0sorting, and calling\u00c2\u00a0operating system\u00c2\u00a0facilities.<\/p>\n<p>Perl takes\u00c2\u00a0lists\u00c2\u00a0from\u00c2\u00a0Lisp,\u00c2\u00a0hashes\u00c2\u00a0(&#8220;associative arrays&#8221;) from\u00c2\u00a0AWK, and\u00c2\u00a0regular expressions\u00c2\u00a0from\u00c2\u00a0sed. These simplify and facilitate many parsing, text-handling, and data-management tasks. Also shared with Lisp are the implicit\u00c2\u00a0return\u00c2\u00a0of the last value in a block, and the fact that all statements have a value, and thus are also expressions and can be used in larger expressions themselves.<\/p>\n<p>Perl 5 added features that support complex\u00c2\u00a0data structures,\u00c2\u00a0first-class functions\u00c2\u00a0(that is,\u00c2\u00a0closures\u00c2\u00a0as values), and an object-oriented programming model. These include\u00c2\u00a0references, packages, class-based\u00c2\u00a0method dispatch, and\u00c2\u00a0lexically scoped variables, along with\u00c2\u00a0compiler directives\u00c2\u00a0(for example, the\u00c2\u00a0<code>strict<\/code>\u00c2\u00a0pragma). A major additional feature introduced with Perl 5 was the ability to package code as reusable modules. Wall later stated that &#8220;The whole intent of Perl 5&#8217;s module system was to encourage the growth of Perl culture rather than the Perl core.&#8221;<\/p>\n<p>All versions of Perl do automatic\u00c2\u00a0data-typing\u00c2\u00a0and automatic\u00c2\u00a0memory management. The interpreter knows the type and\u00c2\u00a0storage\u00c2\u00a0requirements of every data object in the program; it allocates and frees storage for them as necessary using\u00c2\u00a0reference counting\u00c2\u00a0(so it cannot deallocate\u00c2\u00a0circular data structures\u00c2\u00a0without manual intervention). Legal\u00c2\u00a0type conversions\u00c2\u00a0\u00e2\u20ac\u201d for example, conversions from number to string \u00e2\u20ac\u201d are done automatically at\u00c2\u00a0run time; illegal type conversions are fatal errors.<\/p>\n<p>Perl has many and varied applications, compounded by the availability of many standard and third-party modules.<\/p>\n<p>Perl has chiefly been used to write\u00c2\u00a0CGI\u00c2\u00a0scripts: large projects written in Perl include\u00c2\u00a0cPanel,\u00c2\u00a0Slash,\u00c2\u00a0Bugzilla,\u00c2\u00a0RT,\u00c2\u00a0TWiki, and\u00c2\u00a0Movable Type; high-traffic websites that use Perl extensively include\u00c2\u00a0Priceline.com,\u00c2\u00a0Craigslist,\u00c2\u00a0IMDb,\u00c2\u00a0LiveJournal,\u00c2\u00a0DuckDuckGo,\u00c2\u00a0Slashdot\u00c2\u00a0and\u00c2\u00a0Ticketmaster. It is also an optional component of the popular\u00c2\u00a0LAMP\u00c2\u00a0technology stack for\u00c2\u00a0Web development, in lieu of\u00c2\u00a0PHP\u00c2\u00a0or\u00c2\u00a0Python. Perl is used extensively as a\u00c2\u00a0system programming language\u00c2\u00a0in the\u00c2\u00a0Debian\u00c2\u00a0GNU\/Linux distribution.<\/p>\n<p>Perl is often used as a\u00c2\u00a0glue language, tying together systems and interfaces that were not specifically designed to interoperate, and for &#8220;data munging,&#8221;\u00c2\u00a0that is, converting or processing large amounts of data for tasks such as creating reports. In fact, these strengths are intimately linked. The combination makes Perl a popular all-purpose language for\u00c2\u00a0system administrators, particularly because short programs, often called &#8220;one-liner programs,&#8221; can be entered and run on a single\u00c2\u00a0command line.<\/p>\n<p>Perl code can be made portable across\u00c2\u00a0Windows\u00c2\u00a0and Unix; such code is often used by suppliers of software (both\u00c2\u00a0COTS\u00c2\u00a0and bespoke) to simplify packaging and maintenance of software build- and deployment-scripts.<\/p>\n<p>Graphical user interfaces\u00c2\u00a0(GUIs) may be developed using Perl. For example,\u00c2\u00a0Perl\/Tk\u00c2\u00a0and\u00c2\u00a0wxPerl\u00c2\u00a0are commonly used to enable user interaction with Perl scripts. Such interaction may be synchronous or asynchronous, using\u00c2\u00a0callbacks\u00c2\u00a0to update the GUI.<\/p>\n<p>The above is a\u00c2\u00a0 brief about Perl. Watch this space for more updates on the latest trends in Technology.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Perl\u00c2\u00a0is a family of two\u00c2\u00a0high-level,\u00c2\u00a0general-purpose,\u00c2\u00a0interpreted,\u00c2\u00a0dynamic<\/p>\n","protected":false},"author":1,"featured_media":1341,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[816,154,7],"tags":[817,156,18],"class_list":["post-1340","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-perl","category-programming-language","category-techtrends","tag-perl","tag-programming-language","tag-technology"],"_links":{"self":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/comments?post=1340"}],"version-history":[{"count":1,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1340\/revisions"}],"predecessor-version":[{"id":1342,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1340\/revisions\/1342"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media\/1341"}],"wp:attachment":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media?parent=1340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/categories?post=1340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/tags?post=1340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}