#!/usr/bin/perl use strict; use warnings; my @armed_guard = ("watch all night", "fall asleep", "smoke all night"); my @royal_decree = ("Set a man to", "Suppose the man should", "Give him a pipe to"); my @building_outcome = ("falling down", "wash away", "will not stay", "bend and bow", "stolen away"); my @building_material = ("London Bridge", "wood and clay","bricks and mortar", "iron and steel","silver and gold"); my @phrase_glue = ("is", "will", "", "will", "will be"); my $fair_lady = "My fair Lady.\n\n"; # First stanza print join(" ",$building_material[0],$phrase_glue[0],$building_outcome[0]). ",\n"; print $building_outcome[0] . ", " . $building_outcome[0] . ",\n"; print join(" ",$building_material[0],$phrase_glue[0],$building_outcome[0]). ",\n"; print $fair_lady; # middle 8 stanzas for my $i (1..$#building_outcome) { print "Build it up with ".$building_material[$i].",\n"; print $building_material[$i] . ", " . $building_material[$i] . ",\n"; print "Build it up with ".$building_material[$i].",\n"; print $fair_lady; print join(" ",ucfirst($building_material[$i]),$phrase_glue[$i],$building_outcome[$i]).",\n"; print $building_outcome[$i] . ", " . $building_outcome[$i] . ",\n"; print join(" ",ucfirst($building_material[$i]),$phrase_glue[$i],$building_outcome[$i]).",\n"; print $fair_lady; } # final 3 stanzas for my $i (0..2) { print join(" ", $royal_decree[$i], $armed_guard[$i]).",\n"; print $armed_guard[$i].", ".$armed_guard[$i].",\n"; print join(" ", $royal_decree[$i], $armed_guard[$i]).",\n"; print $fair_lady; } exit 0;