my @d; my (@p1, @p2); for (my $i=0;$i<500000000;$i++) { my ($p1,$p2) = getPair(); $d[$p1]++; $d[$p2]++; push @p1, $p1; push @p2, $p2; }