Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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
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: 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. In reply to Storing multiple arguments in a data structure that allows for future expansion by appleb
|
|