Thread permutation (31 answers)
Opened by esskar at 2006-09-11 12:30

peter2k
 2006-09-16 23:35
#69654 #69654
User since
2006-09-16
4 Artikel
BenutzerIn
[default_avatar]
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/perl

use strict;
use warnings;

my $string = 'foo-bar-hutzel-putzel';
foreach(0..7){
my $copy = $string;
map{$_ == 1 ? $copy =~ s/-// : $copy =~ s/-/'/} split//,sprintf "%03b",$_;
$copy =~ s/'/-/g;
print "$copy\n";
}

View full thread permutation