$/ = "\x1f\x0a"; %records = (); %termtoid = (); my $recid = ""; while(<>) {  chomp;  s/\n([[:upper:][:digit:]])/ $1/g;  s/\n//g;  s/% /%/g;  if (/(..)=(.*)/) {    my $key = $1;    my $val = $2;    #print qq([$key]=[$val]\n\n);    if ($key eq 'NR') {      $recid = $val;      $records{$recid} = {};    } else {      $records{$recid}->{$key} = $val;    }    if ($key eq 'DE') {      $termtoid{$val} = $recid;    }  } else {  } }