Chapter 12d - Perl. Perl is a widely used scripting language, which is a high-level language that is interpreted at run time rather than compiled into machine language. Early scripting languages were used to automate job control tasks that a user might perlorrn at the keyboard. | Programming Languages 2nd edition Tucker and Noonan Chapter 12 Imperative Programming I really hate this darn machine; I wish they would sell it; It won’t do what I want it to, but only what I tell it. Programmer’s lament (anonymous) Contents What Makes a Language Imperative? Procedural Abstraction Expressions and Assignment Library Support for Data Structures C Ada Perl Perl is: widely used a scripting language (originally for Unix) dynamically typed encourages a variety of styles supports regular expression pattern matching “Larry Wall . created Perl when he was trying to produce some reports from a Usenet-news-like hierarch of files for a bug reporting system, and awk ran out of steam. Larry, being the lazy programmer that he is, decided to over-kill the problem with a general purpose tool that he could use in at least one other place. The result was the first version of Perl.” Scripting Languages “glue” take output from one application and reformat into desired input format for a different application. most time is spent in the underlying applications. also used for Web applications General Characteristics dynamically typed default conversion from one type to another (vs. Python) result is distinct operators; ex: . for string concatenation types: numbers, strings, regular expressions dynamic arrays: indexed and associative String vs. numeric comparisons: 10 “3465”, “allen” => “3131”, “rebecca” => “2912”); print $d{“bob”}; # prints 3465 Many different ways of saying the same thing Much of the syntax is optional; ex: ( ) Perl 5 added support for classes and objects Great strengths: support for regular expressions Many irregularities in Perl #! /usr/bin/perl die "Usage mygrep string \n" if @ARGV < 1; use strict; my . | Programming Languages 2nd edition Tucker and Noonan Chapter 12 Imperative Programming I really hate this darn machine; I wish they would sell it; It won’t do what I want it to, but only what I tell it. Programmer’s lament (anonymous) Contents What Makes a Language Imperative? Procedural Abstraction Expressions and Assignment Library Support for Data Structures C Ada Perl Perl is: widely used a scripting language (originally for Unix) dynamically typed encourages a variety of styles supports regular expression pattern matching “Larry Wall . created Perl when he was trying to produce some reports from a Usenet-news-like hierarch of files for a bug reporting system, and awk ran out of steam. Larry, being the lazy programmer that he is, decided to over-kill the problem with a general purpose tool that he could use in at least one other place. The result was the first version of Perl.” Scripting Languages “glue” take output from one application and .