perlquestion
ibm1620
<p>I have a file of about 1B records, each containing 50 tab-separated fields. I'm writing a small app to pass this file on an ad-hoc basis, selecting and concatenating various of these fields. </p>
<p>For example: if the input file contains</p>
<p>FIRST\tMIDDLE\tLAST\tSTRNO\tSTRNAME\tCITY\tSTATE\tZIP\t...\n
</p>
<p>I might wish to extract fields 3, 1, and 6:</p>
LAST\tFIRST\tCITY\n
<p>My current approach begins by splitting each record into a 50-element array and then accessing each by index. It's very slow. Can someone suggest a superfast approach to doing this, given only the set of indices I wish to extract?</p>