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;

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: I hate nested loops
by rastoboy (Monk) on Aug 11, 2011 at 16:05 UTC
    lol awesome, thanks! makes sense--I think I need to be doing more slicing :-)