Question 3 The hash slice and the => part turn out to be the most difficult in this section. # part a -- using .. @day_nums = (1 .. 7); # part b -- no explicit use of quotes to assign array of strings @day_strings = qw(mon. tue. wed. thur. fri. sat. sun.); # part c -- use one array as a list of keys and another as a list of # values and create a hash (hash slice) @days1{@day_nums} = @day_strings; # note $days1{@day_nums} = @day_strings is not correct # part d -- create a hash using literals and => %days2 = ( 1 => "mon.", 2 => "tue.", 3 => "wed.", 4 => "thur.", 5 => "fri.", 6 => "sat.", 7 => "sun." ); # note that => automatically quotes the literal before it, but # not any string after it # part e -- use foreach to print values of the hash foreach $value (values(%days)) { print("$value\n"); } # or foreach $key (keys(%days)) { print("$days{$key}\n"); } # part f -- use the each function to iterate through; # capitalize first letter of each value while (($key,$value) = each(%days)) { print("\u$value\n"); } # bonus -- use foreach to print hash in order, mon. tues. etc. # one way; other solutions possible foreach $key (sort(keys(%days))) { print("$days{$key}\n"); } # I was looking for some type of sort on the keys (NOT the values) # this works because '1' < '2' < ... < '7' and '1' is the key for # "mon.", '2' is the key for 'tues.' and so forth # anything that forced order without using the given arrays was ok # other simpler solutions are possible