beginner counting question



Hello,

I have a list like

@list = ('40', '30', '30', '20');

The entries in this list are control numbers
that define the number of steps something
must be done. The question is how a
counting variable can be defined that counts
continuously inside two loops i.e. I want
something like

do 40 steps something and count from 1..40
do 30 steps something and count from 41..70
do 30 steps something and count from 71..100
do 20 steps something and count from 101..120

with two variable $i and $j:


for ($i = 0; $i <= @list; $i++) {

$move_steps = $list[$i];

for ($j = 1; $i <= $move_steps; $i++) {

do something

$count = ???

$name = $nametemplate . "-" . $count . ".JPG";

};
};



Thank you!

Günter

.