Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Generate all possibilities

by Madams (Monk)
on Jun 23, 2001 at 05:47 UTC ( #90914=note: print w/replies, xml ) Need Help??


in reply to Generate all possibilities

I had a similar question awhile back about using a dynamic number of nested for loops (Topic thread here,tilly's answer here).

I wanted to loop through x sets of items and process the combinations:

i.e.: the sets {1,2,3},{a,b,c},{!@#} yield (inorder) 1a!, 1a@, 1a#, 1b!, 1b@, 1b#...3c#

tilly's answer had it all AND made me REALLY understand closures and iterators and how powerfull they really are.


_________________
madams@scc.net
(__) (\/) /-------\/ / | 666 || * ||----||

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://90914]
help
Chatterbox?
[1nickt]: What do you all think of experimental = refaliasing ? Anyone using it?
[1nickt]: \my %foo = { bar => 1 }; say $foo{bar};
[Corion]: 1nickt: Would be great, especially for naming parameters in @_.

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2017-11-17 20:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (272 votes). Check out past polls.

    Notices?