Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: increasing value every time sub routine called

by Fox (Pilgrim)
on Dec 09, 2011 at 12:48 UTC ( [id://942643]=note: print w/replies, xml ) Need Help??


in reply to increasing value every time sub routine called

well, if you really want to do this:
use feature "state"; sub a { state $i++; print $i; } a(); a(); a();
prints 123

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2024-03-28 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found