#!/usr/bin/env perl use strict; use warnings; my ($row, $col) = (1,1); while ($row <= 8 and $col <= 8) { print (($row - 1) * 8 + $col, "\t"); if ($col == 8) { # start next row print "\n"; $row = $row + 1; $col = 1; } else { $col = $col + 1; } }