Paul,
Within the loop, some other programs are executed and occasionally it may take
a few minutes to complete everything and then continue. So I'm just throwing a
little counter to STDOUT so I can monitor the progress, to ensure it doesn't
get hung up somewhere.
I knew of all the different ways
--- Bob Mangold <[EMAIL PROTECTED]> wrote:
> Is there a perl variable that automatically counts loop iterations.
> Such that I don't have to use '$count':
>
> foreach (@array){
> $count++;
> ..whatever..
> }
Lot's of people with suggestions, but I have a question --
what are you using $coun
if your looping thru the elements of an array you can always just grab the #
of elements:
$elem = scalar(@array);
> > Is there a perl variable that automatically counts loop
> iterations. Such that I
> > don't have to use '$count':
> >
> > foreach (@array){
> > $count++;
> > ..whatever..
On Fri, Jun 29, 2001 at 02:58:20PM -0400, Jeff 'japhy' Pinyan wrote:
> No there is not. Either do:
>
> my $i = 0;
> for (@foo) {
> # ...
> }
> continue { $i++ }
>
> or do:
>
> for my $i (0 .. $#foo) {
> my $element = $foo[$i];
> # ...
> }
or
for (my $i = 0; $i < @
On Fri, 29 Jun 2001, Bob Mangold wrote:
> Is there a perl variable that automatically counts loop iterations. Such that I
> don't have to use '$count':
>
> foreach (@array){
> $count++;
> ..whatever..
> }
You can always do, if you need a loop variable:
foreach my $i (0..$#array) {
On Jun 29, Bob Mangold said:
>Is there a perl variable that automatically counts loop iterations. Such that I
>don't have to use '$count':
No there is not. Either do:
my $i = 0;
for (@foo) {
# ...
}
continue { $i++ }
or do:
for my $i (0 .. $#foo) {
my $element = $foo[$i];