in reply to Re^2: How Perl decides where a variable ends and text starts: Match variables in string interpolation
in thread How Perl decides where a variable ends and text starts: Match variables in string interpolation
There are symbolic refs, but you have to stay in the symbolic ref world. If you create ${'1_'} as a symbolic reference, you have to continue to refer to it symbolically only. Perl barfs if you try to use it as $1_ later on. Here's a working example, though:
{ no strict 'refs'; ${'1_'} = 100; print ${'1_'}, "\n"; }
If you go on to dump the %main:: hash you'll see the package global $1_ does exist. Perl's syntax just doesn't support it as anything but a symbolic ref, I think.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How Perl decides where a variable ends and text starts: Match variables in string interpolation
by AnomalousMonk (Archbishop) on Jul 24, 2021 at 00:22 UTC | |
|
Re^4: How Perl decides where a variable ends and text starts: Match variables in string interpolation
by LanX (Saint) on Jul 24, 2021 at 08:31 UTC |