COP3832, Fall 1999, Perl Assignment 1

Due Tuesday 9/28 at the start of class

You may run examples of these scripts from this location: Running Examples. You must have a Java enabled browser.

Read chapter 2 of the Learning Perl book. Write a Perl script that does the following. Please create the script on mongoose.

Here is a sample of the output

Please enter something: 12we3
Please enter something else: 3er4

Here is the input
	something: "12we3

"
	something else: "3er4

"

Here is input after chomp
	something: "12we3"
	something else: "3er4"

Here is the input treated as numbers
	something: "12"
	something else: "3"
	12 + 3 = 15


Here is the input treated as strings, and concatenated
        "12we3" . "3er4" = 12we33er4

Here is the first repeated the second number of times
	"12we3" x "3" = "12we312we312we3"

Read chapters 3 and 4 of the Learning Perl book. Write a Perl script that does the following. Please create the script on mongoose.

Here is a sample of some output

Enter a list of numbers (-1 to stop)
15
32
12
44
56
16
10
21
21
31
-1

Here is the list of numbers you entered
15
32
12
44
56
16
10
21
21
31

Here is the list of numbers you entered in reverse
31
21
21
10
16
56
44
12
32
15

Here is the largest number: 56

Here is the smallest number: 10

Here is the average: 25.8

Here are the numbers above the average 25.8
        32
        44
        56
        31

Read chapter 5 of the Learning Perl book. Write a Perl script that does the following. Please create the script on mongoose.

Here is a sample of the output. Please make up your own hash array.

Here are the keys of the hash
BugsMorkTweetyBillLaverneRalph

Here are the values of the hash
ElmerMindySylvesterBuddyShirleyNorton

Here are the name, value pairs
Bugs Elmer
Mork Mindy
Tweety Sylvester
Bill Buddy
Laverne Shirley
Ralph Norton

Here are the name, value pairs with three pairs deleted
Mork Mindy
Laverne Shirley
Ralph Norton

Where is Perl????

On solix the command for Perl will be
#!/home/sol2/bin/perl

On mongoose the command for Perl will be
#!/usr/local/bin/perl

Creating and Running the program

Handing it in