$var++
123456
sub inc { my $var = shift; ${$var}++ unless ${$var} == $MAX;}# yada yada yadainc(\$var);