Pure Programmer
Blue Matrix


Cluster Map

Project: The Farmer in the Dell (Revisited)

Write a program that prints the lyrics to the song "The Farmer in the Dell". Use a map to hold each person in the song as the key and the person that they "take" as the value. Write a function that prints one verse that takes the key as an argument and prints the correct verse. Write another function to print all the verses.

See [[The Farmer in the Dell]]

Output
$ perl FarmerInTheDell2.pl The famer in the dell The famer in the dell Hi-ho, the derry-o... The famer in the dell The farmer takes the wife The farmer takes the wife Hi-ho, the derry-o... The farmer takes the wife The wife takes the child The wife takes the child Hi-ho, the derry-o... The wife takes the child The child takes the nurse The child takes the nurse Hi-ho, the derry-o... The child takes the nurse The nurse takes the cow The nurse takes the cow Hi-ho, the derry-o... The nurse takes the cow The cow takes the dog The cow takes the dog Hi-ho, the derry-o... The cow takes the dog The dog takes the cat The dog takes the cat Hi-ho, the derry-o... The dog takes the cat The cat takes the mouse The cat takes the mouse Hi-ho, the derry-o... The cat takes the mouse The mouse takes the cheese The mouse takes the cheese Hi-ho, the derry-o... The mouse takes the cheese The cheese stands alone The cheese stands alone Hi-ho, the derry-o... The cheese stands alone

Solution