Perl Lab 5
1. Create an array of string that holds the following information:
- your first name
- your last name
- your student Id
- your nationality
- your favorite Food
- your favorite singer
The print the contents on the screen. A Sample output is shown below:
FirstName: John
LastName: Smith
StudentID: 4777777
Nationality: Canadian
Favourite Food: Poutine
Singer: Drake
2. Write another program that creates the above output using a hash that stores the following key value pair (20 marks):
FirstName - your first name
LastName - your last name
ID - your student ID
Nationality - your nationality
Favourite Food - your favourite Food
Favourite Singer: your Favourite Singer
Process it with a foreach loop that prints the key/value pairs as shown above.
3. Write another program that stores two numbers as integers and prints the following (20 marks):
First Number - 4
Second Number - 2
Sum is 6
Difference is 2
Product is 8
Average is 3
Comments
Post a Comment