Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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: (9)
As of 2014-09-20 12:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (159 votes), past polls