I am sure that I do not understand you question fully, but it sounds like the use of labels and goto statements might help. If so see: perldoc goto If not, sorry...but good luck in your search, and I am sure that some of the much wiser monks will have suggestions.