note
QM
And for completeness, the <code>glob</code> solution, which spends more code fixing up the output than actually generating the results:
<code>
sub qm {
my ($glob) = @_;
my @rv;
$glob =~ s/(\w+)/{$1,}/g;
for my $combo (glob($glob))
{
$combo =~ s/^:+//;
next unless length($combo);
push @rv, join ':', split /:+/, $combo;
}
return @rv;
}
</code>
and is horribly slow as well.
<p>
BTW, it's interesting to note the change in benchmark results when the input is a long list of null strings:
<code>
$source = ':'x20;
</code>
<div class="pmsig"><div class="pmsig-294463">
<p>-QM<br />
--<br />
Quantum Mechanics: The dreams stuff is made of
</div></div>
554374
554374