Help for this page
my %keys = ( a=>1, ... # note that entry 0 is where the unmatched elements wind up... print map{ "@{ $final[$_] }\n" } grep defined $final[$_],1..$#final;
foreach(@records) { my @flds=split /\|/; push @{$final[$keys{$flds[3]}||0]},$_; }