Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

About "state" variables in Perl 5.10

by citromatik (Curate)
on Dec 28, 2007 at 16:02 UTC ( #659342=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub counter {
      state $count = 0;
      $count++;
    }
    
  2. or download this
    {
      my $count = 0;
    ...
        $count++;
      }
    }
    
  3. or download this
    {
      my $count = 0;
    ...
        $count += 2;
      }
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://659342]
Approved by marto
Front-paged by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2021-05-14 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (147 votes). Check out past polls.

    Notices?