Question: Please Help Perl Code Assignment Template Below is the code template you can use. change the items shown in bolded purple in the array and

Please Help Perl Code Assignment Template

Below is the code template you can use. change the items shown in bolded purple in the array and hash of hashes declarations, as well as the H1 tag in the HTML code at the end. The rest of the code will use the team information you entered to produce the reports, and HTML. Following the template code is the sample output it would display in IDEOne. Remember to select Perl

Also

Add at least two more attributes about your team, what other items besides the ones in my examples (yearBorn, Owner, Leader) could you add? Add them to all the areas of your output.

Loop and create a report that will output in XML ... just like you did with the HTML example. The code is very similar to how the HTML section was processed.

# Perl Assignment - Hash of Hashes # Teams using a Hash of Hashes # Superhero Team Year Owner Leader # Justice Society 1940 DC Hawkman # Justice League 1960 DC Superman # Fantastic Four 1961 Marvel Mr. Fantastic # Avengers 1963 Marvel Captain America # X-Men 1963 Marvel Professor X # I have created the following array: @teams = ("Justice Society", "Justice League", "Fantastic Four", "Avengers" , "X-Men"); # and the following Hash of Hashes: %myTeams = ( "Justice Society" => { yearBorn => 1940, owner => "DC", leader => "Hawkman", }, "Justice League" => { yearBorn => 1960, owner => "DC", leader => "Superman" }, "Fantastic Four" => { yearBorn => 1961, owner => "Marvel", leader => "Mr. Fantastic" }, "Avengers" => { yearBorn => 1963, owner => "Marvel", leader => "Captain America", }, "X-Men" => { yearBorn => 1963, owner => "Marvel", leader => "Professor X" }, ); # To print out sorted Team information in the Hash of Hashes (ascending order): print (" My Team - sorted by Team Name ascending: "); printf("%-20s \t%-6s \t%-10s \t%-25s ", "Team", "Year", "Owner", "Leader"); @sortedKeys = sort (@teams); for $teamName (@sortedKeys) { $yearBorn = $myTeams{$teamName}{'yearBorn'}; $owner = $myTeams{$teamName}{'owner'}; $leader = $myTeams{$teamName}{'leader'}; printf("%-20s \t%-6i \t%-10s \t%-25s ", $teamName, $yearBorn, $owner, $leader); print " "; } # To print out sorted Team information in the Hash of Hashes (descending order): print (" \My Team - sorted by Team Name decending: "); printf("%-20s \t%-6s \t%-10s \t%-25s ", "Team", "Year", "Owner", "Leader"); @reverseKeys = reverse (@sortedKeys); for $teamName (@reverseKeys) { $yearBorn = $myTeams{$teamName}{'yearBorn'}; $owner = $myTeams{$teamName}{'owner'}; $leader = $myTeams{$teamName}{'leader'}; printf("%-20s \t%-6i \t%-10s \t%-25s ", $teamName, $yearBorn, $owner, $leader); print " "; } print " HTML Page containing information on my Team: "; print " "; print " "; print "My Team"; print " "; print " "; print "

SuperHero Teams

"; print " "; print " "; for $teamName (sort keys %myTeams ) { $yearBorn = $myTeams{$teamName}{'yearBorn'}; $owner = $myTeams{$teamName}{'owner'}; $leader = $myTeams{$teamName}{'leader'}; print " "; } print "
TeamYearOwnerLeader
$teamName$yearBorn$owner$leader
"; print " "; print " ";

print " XML file containing information on my Team - by Team Name ascending: "; print " "; print " "; for $teamName (sort keys %myTeams ) { print " "; $yearBorn = $myTeams{$teamName}{'yearBorn'}; # do the same thing for owner # do the same thing for leader # do the same thing for the two other attributes print " "; print " $teamName "; # do the same thing for yearBorn # do the same thing for owner # do the same thing for leader # do the same thing for the two other attributes print " "; } print " ";

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!