6 use Digest::MD5 qw(md5_hex);
7 use Data::Dump qw(dump);
10 @files = glob '/tmp/isi.*-*.txt' unless @files;
12 my $path = '/tmp/isi.full.txt';
13 open(my $out_fh, '>', $path);
14 print $out_fh "FN ISI Export Format\nVR 1.0\n";
23 foreach my $file ( sort {
24 my $a_r = $1 if $a =~ m{(\d+)-\d+};
25 my $b_r = $1 if $b =~ m{(\d+)-\d+};
30 push @{ $report->{files} }, $file;
32 open(my $fh, '<', $file);
34 next if m/^(FN|VR|EF)/;
36 if ( ! m/^[\r\n]+$/s ) {
40 my $digest = md5_hex $rec;
41 if ( my $times = $md5->{$digest} ) {
43 $report->{file}->{$file}->{duplicates}++;
45 print $out_fh $rec . $_;
46 $report->{file}->{$file}->{records}++;
47 $report->{total_records}++;
62 warn "# $path ", -s $path, dump $report;