in reply to why does this array take up so much memory?

There are several ways to force Perl use less memory.
  1. using Inline::C create C's subroutine that implements your two-dimensional array
  2. use one single scalar value and simulate your array by taking proper substr
  3. If your array is really all 1-s with few exceptions, just store such exceptions in another array and write a simple sub that simulates your 2D array.
May be some more.

Courage, the Cowardly Dog