in reply to Re^4: Handling HUGE amounts of data
in thread Handling HUGE amounts of data

If it is absolutely necessary to build the whole thing in memory before outputting it, then I would pack the integers in memory.
vec is a usable alternative to pack/unpack, in terms of functionality, though it might be a little more userfriendly in terms of API. Or not, depending on your personal preference.