in reply to Re^2: my $x = <expr>; vs my $x; $x = <expr>;
in thread my $x = <expr>; vs my $x; $x = <expr>;

It's not a bug, it's an accidental feature
Well, that's a matter of semantics:-) In 5.10.0 the form my $x if 0 will be officially deprecated, and will give a warning (and I should know - I added the warning!). It was felt that benefits of the "feature" for eg pseudo-static variables was outweighed by the unexpectedness of its behavour for most people.

Dave.

Replies are listed 'Best First'.
Re^4: my $x = <expr>; vs my $x; $x = <expr>;
by halley (Prior) on Jun 07, 2004 at 15:20 UTC
    Per an email from Larry Wall, he calls it an "accident of implementation." It also has different behavior in differing versions, so I'm glad to see the warning being added. Though I'm not yet won over to the perl6 way of thinking about variable traits.

    --
    [ e d @ h a l l e y . c c ]