in reply to Dynamically assigning number of for loops?

You don't say how your code is supposed to get those values. Let's say for the sake of argument that it is something like this:
my %to_combine = ( A => "0,1", B => "0,1", C => "0,1", X => "0,1", ); # Then the following prints it out... print join " ", sort keys %to_combine; print "\n"; my $s = join "\\ ", map "{$to_combine{$_}}", sort keys %to_combine; print "$_\n" for glob $s;

Replies are listed 'Best First'.
Re^2: Dynamically assigning number of for loops?
by newbio (Beadle) on Oct 23, 2004 at 11:55 UTC
    Terrific, Thanks a lot guys! You guys make problem look so simple which otherwise look invincible to me. Great!

    Tilly, well your hash %to_combine is something that will be passed to the function as you have correctly shown. You have used a function "glob" which seems to work ideally for this job. Could you please elaborate how this function works. I tried checking about this function on google, but in most places it says "glob" is used for finding files/directories, such as *.pl etc. Please tell how it is doing the magic in the present context.

    Hail Monks! Raj

      I was looking back and realized that I never answered this.

      The glob function produces a list of filename expansions in such a way as to mimic how /bin/csh does filename expansions on Unix. The manpage for csh in "Filename substitution" explains the metanotation that I took advantage of to make this give you something other than filenames.