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

Andrew Moore amoore at mooresystems.com
Wed May 9 09:52:47 PDT 2007


On Mon, May 07, 2007 at 07:36:16PM -0500, David Nicol wrote:
> 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"

I'm not sure I get your point here, David. Are you saying that this is
a bug, or unexpected, or undocumented, or something?

I guess I agree that it is complex, at least.

-Andy




More information about the kc mailing list