use Devel::Size qw[total_size]; my @a = ( 0,54,28,76,126,0,28,54,62,54,0,28,54,60,48,0,54,54,62,54,0 ); my $packed = pack 'C*', @a; print 'Memory requirement of ', total_size(\@a) , ' bytes is reduced to ', total_size(\$packed), ' bytes'; Memory requirement of 476 bytes is reduced to 46 bytes. #### my @ind = (0,3,1,6,7,0,1,3,5,3,0,1,3,4,2,0,3,3,5,3,0); my $ind = ''; vec( $ind, $_, 4) = $ind[$_] for 0 .. $#ind; print length $ind; #print 11