appleb has asked for the wisdom of the Perl Monks concerning the following question:

My perl script accepts many arguments via Getopt::Std, for example

perl myScript -i origSamples -p 1 -o 100

all lovely jubbly. Then I decide to improve it so that I can run it many times without having to ask it implicitly by turning the arguments into lists.

perl myScript -i origSamples,moreSamples -p 1,3 -o 100,200

It calls the main processing subroutine many times

processOne('origSamples',1,100) processOne('origSamples',1,200) processOne('origSamples',3,100) processOne('origSamples',3,200) processOne('moreSamples',1,100) ...

but in order to achieve this, there are now many foreach statements that run each argument in combination with each of the other arguments in the other lists. There is one of the following for each argument option, all nested:

if (scalar(@incls) > 0) { foreach $inc (@incls) { $args{i} = $inc; processOneCheckP(); } } else { processOneCheckP(); }
My customer has already added more arguments, so I want to store the arguments in a data structure that will allow me to combine each argument from each list in turn. Then if I add another argument or change it into a list I shouldn't have to recode. Where do I start? Arrays, hashes, hashes of arrays? Something efficient, but allows easy parsing into a list of arguments to send to a subroutine.

Cheers in anticipation.