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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.