Help for this page

Select Code to Download


  1. or download this
    use strict;
    use Algorithm::Loops qw( NextPermute );
    
  2. or download this
    my @list= sort ('A'..'B'); # Find unique permutations for AB?
    my $cnt;
    my @list1;
    
  3. or download this
    # $l represents one blank tile cycling thru all letter values
    for my $l ('A'..'Z') {
    
  4. or download this
      @list1 = sort(@list,$l); # Very important to sort
      print"@list1\n"; # Show what's happening
    
  5. or download this
      printf"%5d. ", ++$cnt;
      print"@list1\n"; # Display permutations
    
      } while( NextPermute( @list1 ) );
    
    }
    
  6. or download this
    print"Counted $cnt unique permutations";
    print $/;
    
  7. or download this
    A A B
     1. A A B
     2. A B A
    ...
    ...
    ...
    Counted 150 unique permutations