Tie::CountLoop is a Perl module that helps you have a counter looping in a scalar with min max and increment value.
SYNOPSIS
use Tie::CountLoop;
tie my $counter , 'Tie::CountLoop',15 ,-1 ,15 ,7 ,0;
my $t = tied $counter;
$t->increment( 1 );
for ( 1 .. 20 )
{
print " n";
}
$t->increment( 0 );
for ( 1 .. 20 )
{
print " n";
}
or
use Tie::CountLoop;
tie my $counter , 'Tie::CountLoop';
for ( 1 .. 20 )
{
print " n";
}
Tie::CountLoop allows you to tie a scalar in such a way that it increments each time it is used. The tie takes 4 optionals extra arguments.
Argument 1: is the start value of the counter. (default =0).
Argument 2: is the increment value. (default = 1).
Argument 3: is the maximal value. When this value is reached, the counter is set to the minimal value (default = (2**32) -1)
Argument 4: is the minimal value. When this value is reached if we used an negative increment value, the counter is set to the maximal value (default = 0)
Argument 5: is a skipping value. If set to 3, means that you could access the counter 3 time without incrementing (defualt=1)
Product's homepage
Requirements:
· Perl