note
rir
This isn't complete, but shows a common approach.
<p>Be well<br>rir
<c>
# XXX lots of possibly magic string literals
$| = 1;
local $_;
while (<DATA>) {
# find next record
next unless /^\s*Record /;
# read a record
$_ = '';
my @record;
do {
s/^ *//;
push @record, $_ if $_ && $_ !~ /^\s*End of Sub/ && $_ !~ /^\s*Sub/;
$_ = <DATA>;
}while ( $_ !~ /^\s*End of Record/ );
# massage the raw data in @record
# XXX incomplete
for my $item ( @record ) {
$item =~ s/" = "/ /;
$item =~ s/"//g;
$item = "F " . $item;
}
@record = sort @record;
# output preamble
print STDOUT "RECORD\n";
print STDOUT "#addkey\n";
print STDOUT "#filename FF\n";
# XXX more?
# output @record
print STDOUT @record;
# output trailer
print STDOUT ".\n";
}
</c>
763564
763564