Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Generating lists of strings

by gmargo (Hermit)
on Jan 24, 2010 at 16:57 UTC ( [id://819316]=note: print w/replies, xml ) Need Help??


in reply to Generating lists of strings

Here's a method using Algorithm::Combinatorics.

use Algorithm::Combinatorics qw(variations_with_repetition); my $length = 4; my @data = qw(1 2 3); my $iter = variations_with_repetition(\@data, $length); while (my $p = $iter->next) { print join("",@$p)."\n"; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-03-28 11:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found