in reply to Specifying a loop with varying number of keys

Build your queries on the fly, once you know whether you're dealing with 2 keys or 3 keys. The SQL is just a string that gets passed to prepare(). 90% of all the DBI queries I've ever run were dynamically generated.

As for your nested for-loops, take a look at Algorithm::Loops for a better solution, particularly the NestedLoops() function.

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

  • Comment on Re: Specifying a loop with varying number of keys

Replies are listed 'Best First'.
Re^2: Specifying a loop with varying number of keys
by periapt (Hermit) on Mar 23, 2005 at 13:03 UTC
    Algorithm::Loops was just what I needed. A few minor changes to the structure of @keylmt and one dynamically defined function template for the iteration test routine and I am off and running. Thanks.

    Maddeningly ironic that in the dozen or so searches and subsearches I ran yesterday, I never thought to use the word, loop. Keys, iterators, for next and so on but not loop. Ah well...

    Thanks again :o)

    PJ
    use strict; use warnings; use diagnostics;