mplete the following tasks: (25 pts.) Write a script to create a hash list for a
ID: 3705635 • Letter: M
Question
mplete the following tasks: (25 pts.) Write a script to create a hash list for at least ten states (GA, NJ, CA, NY, VT, WA, PA, MD, Co, 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 tabuila: form Gyou may use any iteration structure to complete this task) Write a script that would creale 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
Solution:
a)
b)
c)
#!/usr/bin/perl
d)
#!/usr/bin/perl
e)
#!/usr/bin/perl
while (($key, $value) = each (%states))
{
$value = $states{$key};
print " $key $value ";
}
2)
#!/usr/bin/perl
while (($key, $value) = each (%courses))
{
$value = $courses{$key};
print " $key $value ";
}
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.