I've made a wide exploration of the tree, without recursion, the result is akin the one you've shown on your post
#!/usr/bin/perl
@ini_array = getarr("1");
@final_array = (1);
while (@ini_array) {
@aux = ();
push @final_array, @ini_array;
map { push @aux, getarr($_) } @ini_array;
@ini_array = @aux;
}
sub getarr {
$fl = shift; @sublist=();
open(A,"$fl.txt") or die "Can't open $fl.txt";
while (<A>) {
chomp;
push @sublist, $_;
}
close A;
return @sublist;
}
print "final: @final_array\n";
hope that helps...
perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'