ow-solution(8)

NAME
ow-solution - the secrets of the ow code.

SYNOPSIS
ow

DESCRIPTION
The program ow emits the string "the perl journal".

The original inspiration for this program came from the idea of assigning 'a' to a variable and then incrementing it until the string value equaled 'theperljournal' and going from there. However it takes a fairly unreasonable amount of time to increment even from "a" to "perl", when thinking in terms of a contest where the judges have a finite amount of time and CPU to devote to the process of gathering information for their decisions. So rather than create a program that acts like a buggy daemon, I opted to use the same process to generate three-character substrings of the magazine's title to compose into the finished output.

The main trick is stopping the auto-increment loop at the right string without matching on the string itself, since this would divulge the string. So we counted the number of loops necessary to generate each of the desired strings, strung them together into a huge numeric string, and hacked off 5 character substrings to get the numbers of loops.

I decided to generate the "l"s separately since a simple mathematical pattern governs its appearance in the title, and this allowed the rest of the title to be 4 three-character strings. Kind of the same principle applies to the spaces.

The only other obscure item is how I assigned the starting value to the string to increment: s/.*/a/; magically makes $_ appear with nothing in particular inside, but the .* is sufficiently vague that it matches whatever is in there, allowing the substitution with the letter 'a'.

IDENTIFICATION
Ken Rich, kenr@localdomain
Copyright 1998 University Computing Center,
Taylor Hall, University of Rochester,
Rochester, NY   14627