|There's more than one way to do things|
Re: Initializing Hash Arrays in Perlby sundialsvc4 (Abbot)
|on Feb 14, 2014 at 02:06 UTC||Need Help??|
What you are seeing here is a language-feature that does not, if I dimly-recall correctly, does not exist in PHP: auto-vivification.
(It’s pig-latin for “comes to life automagically ...”)
Basically, it works like this: “if Perl finds that whatever-is-required does not exist, Perl will automatically and silently create it.” Therefore, in the start-from-nothing case, Perl will do all of the following:
(Way cool, huh?!)
All of this “convenience” is automatically done by Perl, in the name of “DWIM = Do What I Mean.™” It may be the case that you must write PHP-specific code to do this. (Or not ... It’s been a few months since I’ve thought about PHP, so please don’t quote me on anything.)