_components
is a literal key for the $obj
hash reference. It is not "coming from" anywhere. This is a quirk of Perl syntax. In the statement
$obj->{_components} = [];
$obj
is a reference to a newly created instance of a class (in the prior statement) and _components
is being defined as a key in that instance, and being initialized to a reference to an empty array. This is equivalent to
$obj->{'_components'} = [];
For instance
$ perl -de0
Loading DB routines from perl5db.pl version 1.55
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(-e:1): 0
DB<1> $obj->{a} = "hello";
DB<2> x $obj
0 HASH(0x800756bf8)
'a' => 'hello'
DB<3> p $obj->{'a'}
hello
DB<4> p $obj->{a}
hello
DB<5>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…