I have some large text files which are sorted alphabetically. Also, most lines are variable length. I'd like to make a byte offset index of them, so that I can jump the the position where a line begins with BAX, or TRN, or TUX, or any other combination. I am only interested in the first 3 characters. Would I use pack for this? Right now, my plan is to just grab the first 24 bits of each line, then note the byte offset in the file, keeping only the first unique 24 bits. Is there a more elegant/programatic way?