Arbitrarily Many Nested Loops



This is what I have:

-------------
#!perl

for (my $i = 0; $i<=$n_ra->[0]; $i++) {
for (my $j = 0; $j<=$n_ra->[1]; $j++) {
for (my $k = 0; $k<=$n_ra->[2]; $k++) {
$prob_ra->[$i+$j+$k] += (
$f_raa->[0]->[$i] *
$f_raa->[1]->[$j] *
$f_raa->[2]->[$k] *
);
}
}
-------------
But that's obviously messy and more imprtantly I'd like to be able to
decide at run time to have how nested levels to go (probably be on the
order of 50 or 60). I assume that there's a canonical manner in which
this should be handled (using closures I'd guess) but I can't
sufficiently summarize my issue to make it Google-able.

Any advice?


Many Thanks,
J.

.



Relevant Pages

  • FAQ 7.12 Whats a closure?
    ... This message is one of several periodic postings to comp.lang.perl.misc ... from the documentation provided with Perl. ... Closures are documented in perlref. ... lasting references to lexical variables outside their own scopes. ...
    (comp.lang.perl.misc)
  • FAQ 7.12 Whats a closure?
    ... This message is one of several periodic postings to comp.lang.perl.misc ... from the documentation provided with Perl. ... Closures are documented in perlref. ... lasting references to lexical variables outside their own scopes. ...
    (comp.lang.perl.misc)
  • FAQ 7.12 Whats a closure?
    ... This message is one of several periodic postings to comp.lang.perl.misc ... from the documentation provided with Perl. ... Closures are documented in perlref. ... lasting references to lexical variables outside their own scopes. ...
    (comp.lang.perl.misc)
  • Re: Improving Robins blogger
    ... There are many other free blogger scripts, ... My advice is to investigate the competition. ... "I'm giving away this code as an example for Perl ... If the response time doubles after the one hundred and first username ...
    (comp.lang.perl.misc)
  • Re: Improving Robins blogger
    ... > There are many other free blogger scripts, ... > My advice is to investigate the competition. ... "I'm giving away this code as an example for Perl ... > Create professional-quality user documenation. ...
    (comp.lang.perl.misc)