[Kc] complex initialization of a state variable in current perl (5.8.7)

David Nicol davidnicol at gmail.com
Mon May 7 17:36:16 PDT 2007


sub foo{
        my $hr if 0;
        BEGIN{
                $hr = {foo => 23}
        }
        print $hr->{foo},"\n";
};
defined $hr and die "$hr is defined outside of scope";
foo();  # yes indeedy-doo, prints "23\n"

-- 
practical solutions to systemic problems


More information about the kc mailing list