in reply to Initializing Hash Arrays in Perl
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.)
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Initializing Hash Arrays in Perl
by tobyink (Canon) on Feb 14, 2014 at 09:30 UTC | |
|
Re^2: Initializing Hash Arrays in Perl
by AnomalousMonk (Archbishop) on Feb 14, 2014 at 14:56 UTC | |
by winterwind (Initiate) on Feb 14, 2014 at 19:01 UTC |