sub fbhp { my $string = shift; my $seperator = shift || '-'; my @elements = split /$seperator/, $string; my @status; my $count = $#elements; push @status, 0 for (0..$count); #kann man sich auch sparen my @ret; for (my $i = 1; $i <= 2 ** $count; ++$i) { my $this = $elements[0]; for (my $j = 0; $j < $count; ++$j) { $this .= $seperator if ($status[$j]); if ($i % 2 ** $j == 0) { $status[$j] = (++$status[$j]) % 2; } $this .= $elements[$j+1]; } push @ret, $this; } }