Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Getting combinations from a number's digits

by ioannis (Priest)
on Jul 10, 2006 at 00:55 UTC ( #560041=note: print w/ replies, xml ) Need Help??


in reply to Getting combinations from a number's digits

This solution is based on the combinational powers of glob()

my $txt = '123'; local $"=','; my @array = glob( "{@{[ split(//,$txt)]}}" x length($txt) ); print Dumper \@array ;


Comment on Re: Getting combinations from a number's digits
Download Code
Re^2: Getting combinations from a number's digits
by mikasue (Friar) on Jul 10, 2006 at 01:13 UTC
    um... I learned something. glob() is an actual module. I thought you were using it like we use blah or foo. Thanks, but does this use of glob create the 6 combinations for him? It seems the 6 combinations are hardcoded and he just want to store them somewhere for later use.
Re^2: Getting combinations from a number's digits
by Zaxo (Archbishop) on Jul 10, 2006 at 01:28 UTC

    That glob will also produce 111, 122, etc. Combinations without replacement are needed.

    After Compline,
    Zaxo

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2014-07-14 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (253 votes), past polls