in reply to Re: I hate nested loops
in thread I hate nested loops

That looks interesting, but I do not understand it. I don't suppose you'd care to insert some parentheses, or explain it?

Replies are listed 'Best First'.
Re^3: I hate nested loops
by BrowserUk (Patriarch) on Aug 10, 2011 at 22:48 UTC
    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.
      lol awesome, thanks! makes sense--I think I need to be doing more slicing :-)