There are a great many ways to do it. What have you tried? You could use loop control, implement a simple modification to a C-style for loop, or implement targetsmart's or jethro's ideas with foreach loops. If you need to ask this question, you should probably read perlsyn and pick-up a good intro text.