wyt248er has asked for the wisdom of the Perl Monks concerning the following question:
The perl guide document "perlpacktut" contain the following command statements, which look like assignments.
$UTF8{Euro} = pack( 'U', 0x20AC ); # Equivalent to: $UTF8{Euro} = "\x{20ac}"; $Unicode{Euro} = unpack( 'U', $UTF8{Euro} );
The tokens `$UTF8{Euro}` and `$Unicode{Euro}` seem to be treated as variables. However, the typical perl variables I am familiar with are of the form $v or ${v} but not $v{u}. In fact, the following code ends up with an error.
#!/usr/bin/perl my $v{u} = "hello"; print($v{u}, "\n");
syntax error at ./test.pl line 3, near "$v{u"
What are `$UTF8{Euro}` and `$Unicode{Euro}`? Which perl guide document explain this kind of token?
Thank you in advance.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Variable with curly braces?
by Athanasius (Archbishop) on Oct 24, 2021 at 06:38 UTC | |
Re: Variable with curly braces? (updated)
by AnomalousMonk (Archbishop) on Oct 24, 2021 at 08:24 UTC | |
Re: Variable with curly braces?
by Bod (Parson) on Oct 24, 2021 at 22:14 UTC |
Back to
Seekers of Perl Wisdom