note
Anonymous Monk
This is my code using recursive call.
<code>
#!/usr/bin/perl
use strict;
use warnings;
use Carp;
my @lines = ('A', 'B', 'C');
my @tojoin = qw/X Y W/;
my @new;
sub closure;
sub closure {
my ($ary, $ret) = @_;
if (length($ary->[0]) == 3)
{
return;
}
my @tmp;
foreach (@$ary)
{
foreach my $to (@tojoin)
{
push @tmp, $_ . $to;
}
}
push @$ret, @tmp;
closure \@tmp, $ret;
}
closure \@lines, \@new;
$, = ",";
print @new;
</code>
489142
489152
4