getting to the perl
Let's represent the puzzle with this data structure:
for my $i ( 0..$#data ) { my $srow = int( $i / 9 ); my $scol = $i % 9; my $sblk = int( $scol / 3 ) + int( $srow / 3 ) * 3; my $square = ( $data[$i] =~ m/^[1-9]$/ ) ? $data[$i] : undef; push @$_, \$square for ( $row[$srow], $col[$scol], $block[$sblk] ); }