Re: Javascript: don't move!
by Simon at 17:02 22/03/05 (Forum::Technical Advice::General)
In Perl, (courtesy of Hugo explaining what you mean by static variable :-)) you could have:


{
my $bumCount = 0;
   sub bum {
      $bumCount++;
      warn "Bum has run $bumCount times\n";
   }
}

... ie you create a 'bare block' {} around the subroutine to constrain the scope of $bumCount and ensure that it only gets initialised to 0 the first time the program is run, not for every invocation of the subroutine.
--
simon

<< View comments Iiyama monitors, quickasyoulik... >>
Powered by
Powered by Novacaster