Further to Athanasius's reply:
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.wyt248er: The second method works (without strictures) because it will autovivify a named package-global variable of the correct type if it does not already exist. Package-globals are... well, global, and best practice suggests avoiding their use without a good and well-understood reason. See perldata for more examples of the use of hashes. (Update: And see the Perl Data Structures Cookbook for lots more on hash/array structures.)
Give a man a fish: <%-{-{-{-<
In reply to Re: Variable with curly braces? (updated)
by AnomalousMonk
in thread Variable with curly braces?
by wyt248er
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |