my @bottles_of_beer = map {join "", "$_ bottle", $_ ne 1 && 's' || '', " of beer"}, 'No', 1..99; my $n = 99; while ($n > 0) { say "@bottles_of_beer[$n] on the wall,\n", "@bottles_of_beer[$n].\n", "Take one down, pass it around,\n", "@bottles_of_beer[--$n] on the wall.\n"; } #### sub bottles { my ($n) = @_; return "No bottles" if $n == 0; return "1 bottle" if $n == 1; return "$n bottles"; } for (reverse 1..99) { say bottles($_), " of beer on the wall,"; say bottles($_), " of beer."; say "Take one down, pass it around:"; say bottles($_ - 1), " of beer on the wall."; say ""; }