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

Re^3: initialise state variable from list context, NOT!

by JavaFan (Canon)
on Sep 08, 2009 at 16:21 UTC ( #794168=note: print w/ replies, xml ) Need Help??


in reply to Re^2: initialise state variable from list context, NOT!
in thread initialise state variable from list context, NOT!

One of border cases is:

sub foo { (my $foo, state $bar) = (f(), g()); ... } foo; foo; # Should g() be called?
As for state %record;, that is allowed. It's state in a list assignment that is disallowed. But note that
state %record; %record = ( ... );
doesn't give you any benefits over
my %record = ( ... );
You will have to write it as
state %record; %record = ( ... ) unless keys %record;


Comment on Re^3: initialise state variable from list context, NOT!
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (15)
As of 2015-07-29 16:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (265 votes), past polls