Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Character Combinations

by graff (Chancellor)
on Aug 22, 2003 at 22:44 UTC ( #285944=note: print w/replies, xml ) Need Help??

in reply to Character Combinations

You didn't mention how long the string is supposed to be or how many characters are possible at each position in the string; obviously these points would have an impact on the practicality of the process.

In any case, I think you're mistaken about preferring the use of hashes. Unless I misunderstood your post, the app you're talking about is just a matter of nested loops, one loop for each character position in the string. The inner-most loop prints the concatenation of all the loop iterators. The number of iterations on each loop is simply the number of possible characters to use at the corresponding position. It could be structured recursively to support handling strings of various lengths. But using hashes would be a waste of time, and a vast waste of memory.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://285944]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2021-10-22 18:51 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (85 votes). Check out past polls.