Finest monkish minds of the tubes
Getting to grips with Perl 5.10 I am trying to use a state variable in a little SAX fun I am having. To cut to the chase this bit of code
package XML::SAX::jmeter; use strict; use warnings; use 5.010; use Data::Dumper; use base qw(XML::SAX::Base); sub empty_record { return { getting => 'url', url => 'http://', match => '', getting => '', alarm => 'no', }; } state %record = %{empty_record}; #Initialization of state variables in list #context currently forbidden at ...
I also tried giving the compiler a clue ...
state %record = %{empty_record()}; state %record = %{&empty_record}; state %record = %{&empty_record()};
all the same problem.
now I am using $record holding the array ref and my code works but I would like to know why I could not get the other option to work.
Cheers,
R.
In reply to initialise state variable from list context, NOT! by Random_Walk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |