[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [ID 19991231.001] interpolation of $_ is busted



Bart Schuller writes:
: I've found a bug in interpolation of $_ when followed by the characters [] .
: 
: $ perl5.00503 -e '$_="a"; print "${_}[]\n"'
: a[]
: $ perl5.00562 -e '$_="a"; print "${_}[]\n"'
: []

This appears to be because you've got USE_THREADS defined.  That tends
to lexicalize certain variables, which would tend to rule out lookup
via the symbol name.  Except that ${_} should not be looked up at
runtime in any event.  It has probably confused one or another of
the #ifdef USE_THREADS kludges, is my guess.  I don't have a USE_THREADS
version compiled up here, so someone else will need to chase this down,
unless I get around to it first.

Note that we'd like to move to $_ being lexically scoped over the
long term, but probably only if you actually declare "my $_" up at
the top.  On the other hand, a good argument could be made for
breaking global $_ unless you declare "our $_".

Larry


References to:
Bart Schuller <schuller@lunatech.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]