#!/usr/bin/perl use strict; use warnings; use open ':utf8'; use Getopt::Long; my $conf = {}; # configuration hashref initialize($conf); # build exclusion hash open FP, '<', shift or die "Can't open matchset file: $!\n"; my %exclude = (); while () { my ($lead,$sub) = split /\t/; $exclude{$sub} = 1 unless ($sub < $conf->{lowerbound}); } close FP; # strip exclusions from marcxml file open MI, '<', $conf->{marc} or die "Can't open input file: $!\n"; open MO, '>', $conf->{output} or die "Can't open output file: $!\n"; while () { m/tag="$conf->{tag}",+?(\d+){help}); $conf->{tag} = $conf->{tag} || 903; $conf->{subfield} = $conf->{subfield} || 'a'; my @keys = keys %{$c}; show_help() unless (@ARGV and @keys); for my $key ('output', 'lowerbound', 'input') { push @missing, $key unless $c->{$key} } if (@missing) { print "Required option: ", join(', ', @missing), " missing!\n"; show_help(); } } sub show_help { print <