... for($i=1;$i<=$k;$i++){ print "i = $i, j= $j\n"; # Added to debug ...