The stupid question is the question not asked | |
PerlMonks |
Re: Variable with curly braces?by Athanasius (Archbishop) |
on Oct 24, 2021 at 06:38 UTC ( [id://11137942]=note: print w/replies, xml ) | Need Help?? |
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:
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,
In Section
Seekers of Perl Wisdom
|
|