Hi,
With regards to the script below, can somebody explain to me why $testcounter 
after counting 1,2,3, remains at 3 all the time. I thought it would have been 
reset to zero by the outer while loop.
Thanks

#!c:\perl\bin\perl
use strict;
my $anything = 5;
my $counter =0;

while ($anything > $counter){
     my $testing = 3;
     my $testcounter = 0;
    $counter += 1;
     
     while ($testing > $testcounter ){
        $testcounter += 1;
        test() if (1);
        
        sub test {
          print "$testcounter.\n\n";
        }
     }
}

Reply via email to