Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Why should I use perl 5.10?

by bart (Canon)
on Dec 05, 2007 at 12:40 UTC ( #655075=note: print w/ replies, xml ) Need Help??


in reply to Re: Why should I use perl 5.10?
in thread Why should I use perl 5.10?

  • state variables No more scoping variables with an outer curly block, or the naughty my $f if 0 trick (the latter is now a syntax error).
I think you mean "static variables". A state variable is, generally, just a global variable, typically those used by the system, for example all those variables (with a special name) in perlvar.


Comment on Re^2: Why should I use perl 5.10?
Download Code
Re^3: Why should I use perl 5.10?
by duff (Vicar) on Dec 13, 2007 at 17:42 UTC

    I think the OP means "state variables" as that's what they are called in Perl 6. The declarator is the word state too.

    sub foo { state $x = 0; # $x will retain it's state through # successive invocations of foo() # ... }
    (Yes, other languages use the keyword static, but this is Perl!)
Re^3: Why should I use perl 5.10?
by Limbic~Region (Chancellor) on Dec 13, 2007 at 17:58 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2014-09-21 17:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (173 votes), past polls