in reply to Representing Complex but Static Data in Perl
You might consider making your data an object. Then it's use will be clearer, and you can control access if you need to.
package ChessMoves; sub new { my $class = shift; return bless {0 => { 0 => [ [[1, 0],[2, 0],[3, 0],[4, 0],[5, 0],[6, 0], [7, 0]], [[0, 1],[0, 2],[0, 3],[0, 4],[0, 5],[0, 6],[0, 7]], ] }} $class; } sub get_moves { my $self = shift; my ($row, $col) = @_; return $self->{$row}{$col}; }
|
|---|