You could also rework the nested loops into permutations or globs, and just have a single loop with an iterator.
I would naively suggest glob, but for your example, it eats up memory, and probably doesn't finish:
#!/usr/bin/env perl
use strict;
use warnings;
# dummy values for @p, to get the last values not in a loop
my @p = 0..12;
# a single value
# (this can be generalized, as parameters to a function to generate th
+is string)
my $glob_token = '{0.0,0.2,0.4,0.6,0.8,1.0}';
# join into multiple value string
# (must use non-whitespace, as the builtin glob treats whitespace spec
+ial)
my $glob_parm = join(",", ($glob_token) x 11);
# Loop fork
for my $parm_list (glob($glob_parm)) {
# now fix the commas
$parm_list =~ s/,/\t/g;
my $temp_out = "$parm_list\t$p[11]\t$p[12]\n";
print $temp_out;
}
A similar solution using permutations a combination iterator would work. I'll have to see if I can find my array-of-arrays permutation iterator.
Update: This node on this thread should help.
-QM
--
Quantum Mechanics: The dreams stuff is made of
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.