Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

generating permutations

by Anonymous Monk
on Mar 29, 2017 at 17:20 UTC ( [id://1186402] : perlquestion . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    def permute(in_str, prefix=""):
        if not len(in_str) :
    ...
    
                permute(in_str[:i] + in_str[i + 1:], prefix + in_str[i])
    permute('12345')
    
  2. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
        $k = $l;
        $l = $temp;
        }