-
Notifications
You must be signed in to change notification settings - Fork 577
${::foo} isn't handled correctly #7520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From [email protected]This is a bug report for perl from mharris@litech.org, I can enclose a variable in braces to separate it from surrounding $ perl -we '$foo="hi"; print "${foo}\n"' And I can use $::foo to refer to a name in the 'main' package: $ perl -we '$::foo="hi"; print "$::foo\n"' But if I try to do both together, it produces the correct value but $ perl -we '$::foo="hi"; print "${::foo}\n"' (The fact that I'm interpolating isn't important; dropping the double FWIW, I don't know what $::{foo} is supposed to do, but I wouldn't $ perl -we '$::foo="hi"; print "$::{foo}\n"' Flags: Site configuration information for perl v5.8.5: Configured by Gentoo at Tue Sep 14 21:33:28 Local time zone must be Summary of my perl5 (revision 5 version 8 subversion 5) configuration: Locally applied patches: @INC for perl v5.8.5: Environment for perl v5.8.5: PATH=/bin:/usr/bin:/usr/local/bin:/opt/bin:/usr/i586-pc-linux-gnu/gcc-bi |
From @rgsMatthew Harris wrote:
Here, the second statement tries to look up a variable whose name
It's simply a hash lookup in %:: (a.k.a. the symbol table, documented |
The RT System itself - Status changed from 'new' to 'open' |
@smpeters - Status changed from 'open' to 'rejected' |
From [email protected]Thanks for your quick response. Rafael Garcia-Suarez wrote:
Then why does it still print "hi"? Is it normal for Perl to try to look Even if this is what it's doing, is this correct behavior? My reasoning |
From [email protected]Matthew Harris <matthew.harris@clearsightsystems.com> writes:
nick@llama:/home/p4work/TI/RTLGen> perl -we 'use strict; ${::foo} is a symbolic reference and resolves to $main::foo at run time.
|
From @davidnicol
::foo is a static expression known at compile time, why isn't it optimized? -- |
From [email protected]David Nicol <davidnicol@gmail.com> writes:
I was reporting what happens not why ;-) Doesn't alter the fact that ${"main::foo"} is a symbolic ref |
Migrated from rt.perl.org#31797 (status was 'rejected')
Searchable as RT31797$
The text was updated successfully, but these errors were encountered: