in reply to Re: Loop once on condition 1, many times on cond. 2?
in thread Loop once on condition 1, many times on cond. 2?

In that case you should choose one of the other options so that you don't have to make changes to the call to DoaBunchOfStuff in multiple places - changing the parameter list for example. Repeating the "body" in that fashion also makes it less clear from the flow of the code that the two pieces of controlled work are in fact the same.

In particular, constructing the list to process up front makes it very clear where the processing differences are and what conditions those differences depend on (AnomalousMonk's solution for example).


Perl reduces RSI - it saves typing
  • Comment on Re^2: Loop once on condition 1, many times on cond. 2?