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 "SuperHero Teams
"; print "| Team | Year | Owner | Leader |
|---|---|---|---|
| $teamName | $yearBorn | $owner | $leader |
print " XML file containing information on my Team - by Team Name ascending: "; print " "; print "
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
