Re: Deleting a subfield using MARC::Record

[email protected] (Mark Jordan)
Newsgroups perl.perl4lib
Message-ID <[email protected]>
Edward Summers wrote:

> Deleting subfields is a bit tricky since subfields may 
> repeat, and sometimes people just want to delete one of them. An 
> unfortunate state of affairs perhaps. 

Yeah, I can see what you're saying, but doesn't that also apply to 
repeatable fields? If a particular subfield that is one of a repeated 
set needed to be deleted, it could be identified by a regex or by its 
order in an array (following object syntax probably not correct):

@subfields = $subject->subfields();
foreach $notwanted (@subfields) {
   if ($notwanted =~ /badsubject/) {
       $notwanted->delete_subfield();
   }
}

Mark

-- 
Mark Jordan
Head of Library Systems
W.A.C. Bennett Library, Simon Fraser University
Burnaby, British Columbia, V5A 1S6, Canada
Phone (604) 291 5753 / Fax (604) 291 3023
[email protected] / http://www.sfu.ca/~mjordan/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.