All Perl values are represented internally as perl scalars, which consume way more memory than a simple int. Even if the scalar is only holding an int. Even if the scalar is undef
!
As others have suggested, PDL may be something to look at if you really want to work with huge arrays of this sort.