Re: __FILE__ works as bareword
[email protected] (Dan)
| Newsgroups | perl.perl5.porters |
|---|---|
| Message-ID | <CABMkAVXWWHgWUNGubeye-cH-VDsi54x6Gk0zUXuSJULx73YkZw@mail.gmail.com> |
On Sat, Nov 29, 2025 at 12:39 AM Jim Avera <[email protected]> wrote: > This may have come up before, I don't recall. Special tokens like > __FILE__ are not interpolated if they appear in a position where a > bareword hash key is allowed. > > perl -E 'my @a = (__FILE__ => 42); say $a[0];' # v5.43.2 > >> __FILE__ > > Is this a bug? > No; identifiers are also not resolved to subroutines or other keywords in scope by the autoquoting fat comma. The autoquoting unary minus, of course, has the opposite resolution (-__FILE__). -Dan