in reply to Tic Tac Chop
Your code could have been shortened a bit... Yours was 205... this is a variation of yours at a hefty 200....
$Z='ox'x5;$_="1 2 3\n4 5 6\n7 8 9 ";{$C=chop$Z;print
"\n$_=>$C";{<>=~/(\d)/&&s/$1/$C/m or redo}(/(^($C.){3})
|(($C.{5}){2}$C)|($C.{7}$C.{7}$C)|(^.(...$C){3})/sm
or ++$T>8) or redo}s/\d/-/g;print;
-XDB19