don't be greedy when trying to find end of eval{...}
[webpac] / tools / dump_marc.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4 use MARC;
5
6 my $file = shift @ARGV || die "Usage: $0 [marc file]";
7
8 my $x = new MARC;
9 my $nr = $x->openmarc( { file => $file, format => 'usmarc' });
10
11 # read MARC file in memory
12 $x->nextmarc(-1);
13
14 my $max_rec = $x->marc_count();
15
16 print "file '$file' with '",$x->marc_count(),"' records...\n";
17
18 for(my $i=1; $i<=$max_rec; $i++) {
19         print "REC #$i: ",$x->getfirstvalue({record=>$i,field=>245,subfield=>'a',delimiter=>" "}),"\n";
20         print $x->output({format=>'ascii', record=>$i});
21 }
22