et_alia has asked for the wisdom of the Perl Monks concerning the following question:
What's happening here is I need to increment one item of a list (the for...) and append it to the end of an element of the array, then skip to the next number and pair it up with the next element of the array. The $order variable is a flag to determine whether I need to arrange them in ascending (3..8) or descending (11 -n) order.NUMBER: for (3 .. 8) { my $pdu_num = $_; $pdu_num = 11 - $pdu_num unless defined $order; while (@nodes) { my $node = shift @nodes; $map{$node} = $pdu . '['.$pdu_num.']'; next NUMBER; } }
I couldn't think of a better way to word my title, although I'm sure there is probably a term for what I'm doing here.for my $pdu_num (3 .. 8) { while my $node (@nodes) { # more code here... } }
|
---|