Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Updating A Hash Recursively

by Anonymous Monk
on Sep 06, 2005 at 01:55 UTC ( #489328=note: print w/replies, xml ) Need Help??


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;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://489328]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2020-10-26 16:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (252 votes). Check out past polls.

    Notices?