Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Combinations with variable length

by ikegami (Pope)
on May 12, 2021 at 15:55 UTC ( #11132499=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    for ( 0 .. 2**$n-1 ) {
       my @combo = map { $_ + 1 } split //, sprintf("%0*b", $n, $_);
       say "@combo";
    }
    
  2. or download this
    use Algorithm::Loops qw( NestedLoops );
    
    ...
    while ( my @combo = $iter->() ) {
       say "@combo";
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2021-08-04 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)








    Results (41 votes). Check out past polls.

    Notices?