#! perl -slw use strict; my $pair = 'A25 A15'; ## Assumes the 6 of 125 you need are the 3rd, 33rd, 50th, 75th, 100th, and 123rd, my $tmplNeeded = join ' ', <<"EOT"; x[($pair)2] # skip 2 $pair # grab the 3rd x[($pair)29] # skip 29 $pair # grab the 33rd x[($pair)16] # skip 16 $pair # Grab the 50th x[($pair)24] # ... $pair x[($pair)24] $pair x[($pair)22] $pair EOT open FILE, '<', ...; while( ) { my @required = unpack $tmplNeeded, $_; ## $required[ 0 ] is the 3rd field ## $required[ 1 ] is the 33rd field etc. }