Re: beginner counting question



Purl Gurl wrote:

guba wrote:

That not what I meant. I need all the
intermediate values of $count in the
inner loop for generating $name.
Taking your example @Steps I need for

All intermediate values are there. You
only need to access and use those values.

Pay Attention:

#!perl

@Steps = (2, 4, 4, 2);

for (@Steps)
{
for (1 .. $_)
{
print "$_ ";
$count++;
print "COUNT: $count\n"
}
}

PRINTED RESULTS:

1 COUNT: 1
2 COUNT: 2
1 COUNT: 3
2 COUNT: 4
3 COUNT: 5
4 COUNT: 6
1 COUNT: 7
2 COUNT: 8
3 COUNT: 9
4 COUNT: 10
1 COUNT: 11
2 COUNT: 12


Purl Gurl
.