in reply to A way to pack string into another light weight structure

pack 'L',$number but this will fail if you have any numbers bigger than 4294967295 (2**32-1), in which case, barring any knowledge of large, unused ranges, 5 bytes is the best you're going to do, and you may as well be doing pack 'H10',$number

However, instead of trying to compress things, you might be better off using an off-line algorithm that doesn't require everything being in memory at once, e.g.,

  1. open 16 new files for writing
  2. go through the array sequentially, copy each record to a randomly chosen file of the 16.
  3. close all of the files
  4. randomize each file (~7M) separately
  5. concatenate