in reply to Convert array to tree OR why variable changes arbitrarily
Also can somebody claify differences betweenperl -le ' use strict; use warnings; use Data::Dumper; my @arr = ("ng1", ["ng1_1", "ng1_2", "ng1_2"]); my @tree; $tree[0] = $arr[0]; $tree[1] = $arr[1]; $tree[1] = '2'; print Dumper @arr; '
and$arr[$i+1]
I understand that second is some kind of "hard copy" but can you please specify what is going on with those braces? It seems to me as dereferencing which is referenced. Does it have something common with, following two[ @{$arr[$i+1]} ]
Also can you please clarify the differences between last two lines? Are there simmilar or tehere are some differences? Thank you very much for all your help.$aref = [@flinstones]; $aref = \@flinstones;
|
|---|