5 use Encode qw(:fallback_all);
7 my $batch = MARC::Batch->new( 'USMARC', @ARGV );
8 my $oldencoding = $PerlIO::encoding::fallback;
10 $batch->warnings_off();
12 my ($count_raw, $count_attempted, $count_901c) = (0, 0, 0);
14 while ( my $marc = $batch->next ) {
15 $PerlIO::encoding::fallback = Encode::WARN_ON_ERR | Encode::PERLQQ;
18 my $field_901c = $marc->subfield(901,"c");
19 if(defined $field_901c) {
21 $count_901c++ if ($field_901c =~ /^.+$/);
22 printf "%s\n",$field_901c;
26 warn "Inner: $@" if $@;
29 warn "Outer: $@" if $@;
31 $PerlIO::encoding::fallback = $oldencoding;
32 printf STDERR "Count (attempted): %d\n",$count_attempted;
33 printf STDERR "Count (raw): %d\n",$count_raw;
34 printf STDERR "Count (901c): %d\n",$count_901c;