perl - Please explain me what is hapenning in line 3 of this code -
Please tell me what is happening in the 3 line of this code.
For my $ I (0 .. $ dim) {my $ j (0 .. $ dim) {$ adj-> [$ i] [$ j] = $ adj- & Gt; [$ I] for [$ j]? [$ J]: [];
Code loop
$ adj . Possibly,
$ dim
is a dimension, and iterate over the list of numbers from$ i
and$ j
to0
For$ dim
, for example0,1,2,3,4,5
.For each combination of numbers, the value of that array element is checked for the accuracy, and it is assigned a new value. If the value is false, then this index is assigned to an array referee with
$ j
, otherwise the empty table[]
.The conditional operator is used here with the original syntax
condition? FOO: BAR If the condition is then FOO AND BAR
Probably, array reference should be array reference in
$ adj
, which is why it is only true Can checkdefined $ adj-> As a shortcut for [$ i] [$ j]
Comments
Post a Comment