#!/usr/local/bin/perl
use strict;
use warnings;
use TextRecordConverter;
my $cmdname = $0; $cmdname =~ s{.*/}{};
my $key = 'isbn';
my $inconv = new TextRecordConverter
fieldnames => [qw(isbn author title)],
fieldsep => ':', escape => '%';
my $outconv = new TextRecordConverter
fieldnames => [qw(author title)],
fieldsep => ':', escape => '%';
while (<>) {
chomp;
my $line = $_;
my $record = $inconv->line_to_record($line);
my $contents = $outconv->record_to_line($record);
my $key = $record->{$key};
print "+", length($key), ",", length($contents), ":",
$key, "->", $contents, "\n";
}
print "\n";
|