in reply to Re^2: I hate nested loops
in thread I hate nested loops
I don't suppose you'd care to insert some parentheses,
I don't think adding unnecessary parens would help at all :)
or explain it?
Sure:
@{ $netifaces->{ $_ } }{ @nets } = (1) x @nets for @eths; ^^^^^^^^^^ a hash reference @{ $netifaces->{ $_ } }{ @nets } = (1) x @nets for @eths; ^^^^^^^^^^^^^^^^^^ an element in that hash @{ $netifaces->{ $_ } }{ @nets } = (1) x @nets for @eths; iterated over ^^^ + @{ $netifaces->{ $_ } }{ @nets } = (1) x @nets for @eths; by these keys ^^^^^ @{ ... }{ @nets } ^^^^^^^^^^^^^^^^^^ a hash slice with the keys in @nets @{ ... }{ @nets } = (1) x @nets ...; is assigned ^ ^^^^^^^^^^^ a list of '1's the size of @nets
Putting that all together, we get:
For each value in @eths, create a key in $netifaces with a value that consists of a hash containing all of the keys in @nets, each with the value 1.
Eg.
@{ $netifaces->{ $_ } }{ @nets } = (1) x @nets for @eths;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: I hate nested loops
by rastoboy (Monk) on Aug 11, 2011 at 16:05 UTC |