This should give you a starting point:
#!/usr/bin/perl
use strict;
my @fields = ("title","author","pub-date","format","publisher");
my %fields_hash = ("title",1,"author",1,"pub-date",1,"format",1,"publisher");
while (<>) {
my $string = $_;
my (@pairs) = split(/:/, $string);
my @sequence =...