I see a few things, here.
First, you should always use:
use strict; use warnings; use diagnostics; # not everyone puts this in but I think it's helpful
But that's just general stuff. The big question I have is why use a while (especially with the -- eesh -- next statement) when an if is really what you want? Rewriting this using your (excellent) suggestion of the reformulated for:
foreach my $pdu_num (3 .. 8) { $pdu_num = 11 - $pdu_num unless defined $order; if (my $node = shift @nodes) { $map{$node} = $pdu . '['.$pdu_num.']'; } }
gives, I think, a much clearer chunk of code
In reply to Re: More effective way to increase two elements of a list in parallel?
by wade
in thread More effective way to increase two elements of a list in parallel?
by et_alia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |