Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: About "state" variables in Perl 5.10

by Limbic~Region (Chancellor)
on Dec 28, 2007 at 18:48 UTC ( #659377=note: print w/replies, xml ) Need Help??


in reply to About "state" variables in Perl 5.10

citromatik,
In addition to what others have said, in the simple case (single sub), there isn't the need for the extra scope. When you need more than one sub to share, the old trick still works for that. There are many more things you can do with state though. See How will you use state declared variables in Perl6? for a more in-depth discussion. I used the state variables to create pseudo objects before Pugs had objects. You can see a perl 5.10.0 example here.

Cheers - L~R

  • Comment on Re: About "state" variables in Perl 5.10

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://659377]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2021-05-13 01:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (134 votes). Check out past polls.

    Notices?