Hello wyt248er, and welcome to the Monastery!
The syntax $UTF8{Euro} = ...; is indeed a variable assignment, but the variable assigned to in this case is a member of a hash. You can see this yourself in two ways:
# Method 1: With an explicit declaration use strict; use Data::Dump; my %v; # Hash declaration $v{u} = "hello"; print $v{u}, "\n"; dd %v; # Show the contents of the hash
# Method 2: Without a declaration # No "use strict" here! use Data::Dump; $v{u} = "hello"; print $v{u}, "\n"; dd %v; # Show the contents of the hash
The first method declares the hash %v using the my keyword, as mandated by the use strict; pragma. This is good practice. The second method just uses the hash without first declaring it. This will work only if the use strict; pragma is not in effect. This is considered bad style in modern Perl.
Bear in mind that the Perl documentation has been around for some time, and may pre-date modern best practice. In any case, the code examples in the documentation are snippets only, not complete scripts.
Update: Added 2 code comments
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Variable with curly braces?
by Athanasius
in thread Variable with curly braces?
by wyt248er
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |