in reply to Bare blocks forgetting lexical values

I would assume it's because the my $x is optimized to a pad access at compile time. You're not initilizing it so it has it's old value. This sounds like the "my $x if 0 bug". This statement by Elian might shed some light on it as well.

-Lee

"To be civilized is to deny one's nature."
  • Comment on Re: Bare blocks forgetting lexical values

Replies are listed 'Best First'.
Re: Re: Bare blocks forgetting lexical values
by Elian (Parson) on Dec 17, 2002 at 22:15 UTC
    Yep, that's likely it. Whether this is a bug or a feature is up in the air--personally I don't think you're supposed to be able to jump into the middle of a block, but...
      Personally, I think of it as a feature. It does what it says it does, just not what some would expect. I've never used it as I've always had the feeling it would be fixed and making an outer scope is simple and clearer.

      -Lee

      "To be civilized is to deny one's nature."