On Wed, Sep 20, 2000 at 07:20:44PM -0700, Steve Fink wrote:
> Tom Christiansen wrote:
> > Steve Fink wrote:
> > >% perl -we '$x = 3; $v = "x"; eval "\$$v++"'
> > >Name "main::x" used only once: possible typo at -e line 1.
> >
> > Non sequitur. And no, I don't have time.
>
> It is relevant in that perl's existing behavior has proven to be
> useful even though the implementation is not correct.

I think Tom's point is that the eval has nothing to do with what
you're showing.

  [~] $ perl -we '$x = 3; $v = "x"; eval "\$$v++"'
  Name "main::x" used only once: possible typo at -e line 1.
  [~] $ perl -we '$x = 3; $v = "x"; $$v++'
  Name "main::x" used only once: possible typo at -e line 1.

> The correct implementation would not have issued the above warning,
> because an eval"" was present in the code. However, the correct
> implementation would also fail to warn in many legitimate cases. The
> current heuristic seems to strike a pretty good balance:
>
> % perl -le '$x = 3; eval "\$x++"'
> (no warning issued)

  [~] $ perl -wle'$x = 3; eval "\$x++"'
  Name "main::x" used only once: possible typo at -e line 1.

Reply via email to