Re: every combination of Y/N in 5 positions
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: every combination of Y/N in 5 positions         

Group: comp.lang.perl.misc · Group Profile
Author: Sandy
Date: Mar 31, 2008 14:21

On Mar 31, 1:57 pm, joemacbusin...@yahoo.com wrote:
>
> This has probably already been written but I did not see it on CPAN.
> Is there a code snippent that can print every possible combination
> of Y/N's in a 5 position array or string?

If I understand you correctly, it sounds like a 5-bit binary with N
and Y instead of 0 and 1. Try looping through numbers 0..31 (max 5-bit
number) and call some transforming function (let's call it to_string),
which would loop trough the bits and produce a string of Ys and Ns
accordingly. I intentionally give you just an idea, so you could be
proud of yourself implementing it :) It will take some 15 lines of
code.

/sandy
http://myperlquiz.com/
no comments
diggit! del.icio.us! reddit!