Second: of all this has to be one of the weirdest posts I have seen and I have seen some real doosies.
Third: This is probably homework and its obvious you signed up to Perlmonks just to ask this question hoping that someone would just whip this out for you.