in reply to Storing variable coordinates in a matrix
Also I'd be expecting to pass five variables to a more generic subroutine -- reference to screen matrix, x, y, width and height rather than hard-code the 3x3.
Totals: 0 modules and about 6 - 12 lines of code should do this.
More hint: the syntax for assigning to an element of a matrix passed by reference would be
$ref -> [$x][$y] = 'X';
Free your mind