It's hard to beat nested foreach loops for simplicity and readability in the example you provided. But if there is a Perl5 alternative, it's probably found in tye's Algorithm::Loops. In specific, you could accomplish the same like this:
NestedLoops( [ \@eths, \@nets ], sub{ $netfaces->{ $_[0] }{ $_[1] } = 1; } );
Your posted example is what everyone's going to expect to see. But I would guess that any reasonably experienced programmer would be able to look at the snippet posted in this node and know pretty quickly what is going on.
Dave
In reply to Re: I hate nested loops
by davido
in thread I hate nested loops
by rastoboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |