http://www.perlmonks.org?node_id=489328


in reply to Re: Updating A Hash Recursively
in thread Updating A Hash Recursively

This is my code using recursive call.
#!/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;