http://qs321.pair.com?node_id=471226


in reply to Re^3: Sudoku puzzles solved using Regular Expressions
in thread Sudoku puzzles solved using Regular Expressions

Yeah, there are diminishing returns to adding more shortcuts.

Technically, $grid_v is not needed at all.

return if index(substr($grid_v, $x*$size, $size), $n) >= 0;

can be written as

foreach my $y_ (0 .. $size-1) { return if substr($grid_h, $y_*$size+$x, 1) eq $n; }

I just thought the former would be faster, even though we must constantly make copies of $grid_v in addition to $grid_h.