for my $x (0..5) { for my $y (0..$x-1) { print "Info for pair ($x, $y) is stored at: ",$x*($x-1)/2+$y,"\n"; } }