Another way. No special-casing needed for 0, 1 element arrays/lists.
c:\@Work\Perl>perl -wMstrict -le "my @node_names = qw(PA5098 PA5100 PA5092 PA3175); ;; for my $i (0 .. $#node_names) { my @following = $i+1 .. $#node_names; for my $j (@following) { print qq{$node_names[$i] $node_names[$j] }, $j - $i; } } " PA5098 PA5100 1 PA5098 PA5092 2 PA5098 PA3175 3 PA5100 PA5092 1 PA5100 PA3175 2 PA5092 PA3175 1
In reply to Re: problem with loop
by AnomalousMonk
in thread problem with loop
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |