Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How can one generate all possible permutations of r elements out of n where r<n?

by BrowserUk (Patriarch)
on Feb 26, 2013 at 12:29 UTC ( [id://1020679]=note: print w/replies, xml ) Need Help??


in reply to How can one generate all possible permutations of r elements out of n where r<n?

C:\test>perl -MAlgorithm::Combinatorics=variations -E"$i=variations( [ +'A'..'D'], 3 ); say @$_ while $_= $i->next" ABC ABD ACB ACD ADB ADC BAC BAD BCA BCD BDA BDC CAB CAD CBA CBD CDA CDB DAB DAC DBA DBC DCA DCB

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: How can one generate all possible permutations of r elements out of n where r<n?
  • Download Code

Replies are listed 'Best First'.
Re^2: How can one generate all possible permutations of r elements out of n where r<n?
by supriyoch_2008 (Monk) on Feb 27, 2013 at 09:11 UTC

    Hi BrowserUK,

    Thank you very much for the code. But I am sorry that I do not understand the code as it does not start with #!/usr/bin/perl, the code I am a little acquainted with.

    With regards.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-20 03:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found