Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: finding combinations and removing selective duplicates

by poolpi (Hermit)
on Dec 18, 2008 at 11:49 UTC ( [id://731230]=note: print w/replies, xml ) Need Help??


in reply to finding combinations and removing selective duplicates

If you need to deal with combinatorial sequences :
Algorithm::Combinatorics

#!/usr/bin/perl use strict; use warnings; use Algorithm::Combinatorics qw(variations_with_repetition); my @data = qw(a b c); my $iter = variations_with_repetition( \@data, $#data ); while ( my $c = $iter->next ) { print @$c, "\n"; } __END__ Output: aa ab ac ba bb bc ca cb cc


hth,
PooLpi

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-24 22:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found