This might help?
There are duplicates, eg 12 and 21.
#!/usr/bin/perl
use strict;
use warnings;
my @perms = glob "{1,2,3}" x 3;
print "@perms\n";
@perms = glob "{1,2,3}" x 2;
print "@perms\n";
__END__
Prints:
111 112 113 121 122 123 131 132 133 211 212 213 221 222 223 231 232 23
+3 311 312 313 321 322 323 331 332 333
11 12 13 21 22 23 31 32 33
Another run:
#!/usr/bin/perl
use strict;
use warnings;
my @perms = glob "{a,b,c,d,e}" x 3;
print "@perms\n";
print "\n";
@perms = glob "{a,b,c,d,e}" x 2;
print "@perms\n";
__END__
Prints:
aaa aab aac aad aae aba abb abc abd abe aca acb acc acd ace ada adb ad
+c add ade aea aeb aec aed aee baa bab bac bad bae bba bbb bbc bbd bbe
+ bca bcb bcc bcd bce bda bdb bdc bdd bde bea beb bec bed bee caa cab
+cac cad cae cba cbb cbc cbd cbe cca ccb ccc ccd cce cda cdb cdc cdd c
+de cea ceb cec ced cee daa dab dac dad dae dba dbb dbc dbd dbe dca dc
+b dcc dcd dce dda ddb ddc ddd dde dea deb dec ded dee eaa eab eac ead
+ eae eba ebb ebc ebd ebe eca ecb ecc ecd ece eda edb edc edd ede eea
+eeb eec eed eee
aa ab ac ad ae ba bb bc bd be ca cb cc cd ce da db dc dd de ea eb ec e
+d ee
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.