# ... $canvas-> Tk::bind( '', [ \&set_coord, Ev('x'), Ev('y') ]); $canvas-> Tk::bind( '', [ \&set_coord, Ev('x'), Ev('y') ]); $canvas-> Tk::bind( '', [ configure => '-cursor', 'crosshair' ]); # ... sub set_coord { my ( $canv, $x, $y ) = @_; my $r = int( $y / $tile_h ); my $c = int( $x / $tile_w ); my ( $item ) = $canv-> find( withtag => "$r-$c", ); $canv-> itemconfigure( $item, -text => $default_char ); }