Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Is this BEGIN construct supposed to work?

by ikegami (Pope)
on Nov 02, 2011 at 23:47 UTC ( #935521=note: print w/ replies, xml ) Need Help??


in reply to Is this BEGIN construct supposed to work?

Maybe you want state?

sub routine { state %hash = ...; ... %hash ... }

It's kinda like the following, but the assignment is actually done the first time state is evaluated.

my %hash; BEGIN { %hash = ...; } sub routine { ... %hash ... }


Comment on Re: Is this BEGIN construct supposed to work?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-10-24 07:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (130 votes), past polls