Hi Folks: It is me again. I have another question... I am helping someone clean up her database. Somehow, the 856 field in her MARC records has duplicated itself several times. She has some records with 15+ duplicate 856 fields. So I am trying, unsuccessfully, to modify one of my scripts to delete the duplicate fields. The problem I am having is that out of the 15+ 856 fields, 3 of the 856 fields are unique to the record and need to stay. Here is my code so far: ## create a MARC::File::USMARC object use MARC::Batch; my $infile = shift; my $otfile = shift; my $batch = MARC::Batc Michael L. Bowden Coordinator of Automation and Access Services Associate Professor, Information Science Harrisburg Area Community College One HACC Drive Harrisburg, PA 17110-2999
E: [EMAIL PROTECTED] T: 717.780.1936 F: 717.780.2462h->new('USMARC',$infile); $batch->strict_off(); open (DBOUT, "> $otfile"); ## if $file isn't defined we had trouble with the file ## so exit if (not($infile)) { print $MARC::File::ERROR,"\n"; exit(0); } while (my $record = $batch->next()) { my @m856 = $record->field('856'); @m856 = sort {$a cmp $b} @m856; my %seen = (); my @new856 = (); foreach ( $record->fields() ) { if (@m856) { foreach $f (@m856) { next if ($seen{ $f }++); push @new856, $f; $record->delete_field($f); } } } $record->insert_fields_ordered( @new856 ); print DBOUT $record->as_usmarc(); } When I run this script, It put ALL the 856 fields back in the record and they are not sort. What am I doing wrong? TIA! Michael Harrisburg Area Community College