Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

THIS IS PERL SCRIPTING! NEED HELP ASAP! Due in 1 hour and 15 minutes mplete the

ID: 3705626 • Letter: T

Question

THIS IS PERL SCRIPTING! NEED HELP ASAP! Due in 1 hour and 15 minutes

mplete the following tasks: (25 pts.) CA, NY, VT, WA, PA, MD, co, Write a script to create a hash list for at least ten states (GA, NJ b) Print 3 of states by accessing their keys c) Replace the values of three states since you notice you make a mistake while assigning their values. d) Remove three of the states of your choice. e) Print the hast list in a tabular form (you may use any iteration structure to complete this task) Write a script that would create a hash list of the courses you are taking this semester, you must assigned the course abbreviation (ex. CS2215) and course description (Perl Scripting), finally display in a tabular form all the courses. (10 pts.) 2)

Explanation / Answer

ANSWER

a)

#!/usr/bin/perl
%states = ('GA' => 'Georgia', 'NJ' => 'New Jersey', 'CA' => 'California', 'NY' => 'New York', 'VT' => 'Vermont', 'WA' => 'Washington', 'PA' => 'Pennsylvania', 'MD' => 'Maryland', 'CO' => 'Colorado' , 'IL' => 'Illinois');
b)

#!/usr/bin/perl

%states = ('GA' => 'Georgia', 'NJ' => 'NewJersey', 'CA' => 'California', 'NY' => 'NewYork', 'VT' => 'Vermont', 'WA' => 'Washington', 'PA' => 'Pennsylvania', 'MD' => 'Maryland', 'CO' => 'Colorado' , 'IL' => 'illinois');
print "$states{'GA'} ";
print "$states{'NJ'} ";
print "$states{'CA'} ";
c)

#!/usr/bin/perl

%states = ('GA' => 'Georgia', 'NJ' => 'NewJersey', 'CA' => 'California', 'NY' => 'NewYork', 'VT' => 'Vermont', 'WA' => 'Washington', 'PA' => 'Pennsylvania', 'MD' => 'Maryland', 'CO' => 'Colorado' , 'IL' => 'illinois');
$states{'NJ'} = 'New Jersey';
$states{'NY'} = 'New York';
$states{'IL'} = 'Illinois';
d)

#!/usr/bin/perl

%states = ('GA' => 'Georgia', 'NJ' => 'NewJersey', 'CA' => 'California', 'NY' => 'NewYork', 'VT' => 'Vermont', 'WA' => 'Washington', 'PA' => 'Pennsylvania', 'MD' => 'Maryland', 'CO' => 'Colorado' , 'IL' => 'illinois');
delete $states{'GA'};
delete $states{'NJ'};
delete $states{'CA'};
e)

#!/usr/bin/perl

%states = ('GA' => 'Georgia', 'NJ' => 'NewJersey', 'CA' => 'California', 'NY' => 'NewYork', 'VT' => 'Vermont', 'WA' => 'Washington', 'PA' => 'Pennsylvania', 'MD' => 'Maryland', 'CO' => 'Colorado' , 'IL' => 'illinois');
while (($key, $value) = each (%states))
{
$value = $states{$key};
print " $key $value ";
}

2)

#!/usr/bin/perl

%courses = ('CS2215' => 'Pearl Scripting', 'CS2216' => 'Web Technologies', 'CS2217' => 'Programming Langauges', 'CS2218' => 'Machine Learning');
while (($key, $value) = each (%courses))
{
$value = $courses{$key};
print " $key $value ";
}