# we declare 8 arrays, named a to h, representing each column bottom to top i.e. @a[1] refers to the square a1 and @a[8] refers to a8. # also, we are *not* using the zero-indexed position. # the first 33 elements of each column need to " " initially my ( (@a = " " xx 33), (@b = " " xx 33), (@c = " " xx 33), (@d = " " xx 33), (@e = " " xx 33), (@f = " " xx 33), (@g = " " xx 33), (@h = " " xx 33) ); #the drawing function. we draw from top row to bottom row. (while in chess the lowest row is called '1'!) # expected output: # a b c d e f g h # +---+---+---+---+---+---+---+---+ # 8 | | | | | | | | | 8 # +---+---+---+---+---+---+---+---+ # 7 | | | | | | | | | 7 # +---+---+---+---+---+---+---+---+ # 6 | | | | | | | | | 6 # +---+---+---+---+---+---+---+---+ # 5 | | | | | | | | | 5 # +---+---+---+---+---+---+---+---+ # 4 | | | | | | | | | 4 # +---+---+---+---+---+---+---+---+ # 3 | | | | | | | | | 3 # +---+---+---+---+---+---+---+---+ # 2 | | | | | | | | | 2 # +---+---+---+---+---+---+---+---+ # 1 | | | | | | | | | 1 # +---+---+---+---+---+---+---+---+ # a b c d e f g h say " a b c d e f g h "; for (1..8) { say " +---+---+---+---+---+---+---+---+"; say "9-$_ | @a[9-$_] | @b[9-$_] | @c[9-$_] | @d[9-$_] | @e[9-$_] | @f[9-$_] | @g[9-$_] | @h[9-$_] | 9-$_"; } say " +---+---+---+---+---+---+---+---+"; say " a b c d e f g h ";