It looks like you need to store up your $NUM17 values in an array, and you also need to store up your RES-val pairs in a hash. Then, after you've read and stored the whole mess, go through the array and print the corresponding hash values. Like:
my @requests = ();
my %lookups = ();
while (<FILE>) {
if (/^# input/) {
push @requests, (split)[1];
}
elsif (/^\s\s\d+/) {
my ($RES, $val) = (split)[2,4]
$lookups{$RES} = $val;
}
}
print join("\n", @lookups{@requests}), "\n";
It's not clear to me what the $NUM17 and $NUM18 business is all about, or what $etc is for. What I've done is assume that $etc indicates which $RES to look for, to print the associated $val.
We're not really tightening our belts, it just feels that way because we're getting fatter.
| [reply] [d/l] |