Mark Jordan wrote:
Hi everybody,
Any advice on how I'd go about using MARC::Record to delete just a
specific subfield? The old MARC.pm had deletemarc(), which would "delete
entire records, specific fields, as well as specific subfields depending
on what parameters are passed to it."
Or should I just reconstruct the field, leaving out the unwanted subfield?
I'm no expert, but that's what I've done. Here are a few snippets of code.
First I pull the subfields into an array:
@subfields = $field->subfields();
Then loop through the subfields, putting the ones I want to keep into a
new array:
unless ($zapsub eq true) {
push(@new856s,$sfcode,$sftext);
}
Finally, create a new field from the new array and replace the old one
with it:
my $new856f = MARC::Field->new('856',$i1,$i2,@new856s);
$field->replace_with($new856f);
If there's an easier way, I'd like to know!
Mike
--
Michael Kreyche
Systems Librarian
Associate Professor
Kent State University Libraries and Media Services
http://www.personal.kent.edu/~mkreyche
330-672-1918