Re: Deleting a subfield using MARC::Record

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

> The current documentation for the new method reads like this:
> 
> -- 
> 
>        delete_subfield() allows you to remove subfields from a field:
> 
>            # delete any subfield a in the field
>            $field->delete_subfield(code => 'a');
> 
>            # delete any subfield a or u in the field
>            $field->delete_subfield(code => ['a', 'u']);
> 
>        If you want to only delete subfields at a particular position you 
> can
>        use the position parameter:
> 
>            # delete subfield u at the first position
>            $field->delete_subfield(code => 'u', position => 0);
> 
>            # delete subfield u at first or second position
>            $field->delete_subfield(code => 'u', position => [0,1]);

If you implemented negative indexes, it would be nice to add an example:

             # delete subfield u at last position
             $field->delete_subfield(code => 'u', pos => [-1]);

>        You can specify a regex to for only deleting subfields that match:
> 
>           # delete any subfield u that matches zombo.com
>           $field->delete_subfield(code => 'u', match => qr/zombo.com/);

The term "position" ("pos") seems a little ambiguous to me on the face 
of it. Does (code => 'u', pos => 0) mean "the first subfield u" (which 
is what  I take it to mean) or "subfield u if it's the first subfield" 
(which it might sound like outside the context of this discussion)?

Mike
-- 
Michael Kreyche
Systems Librarian
Associate Professor
Kent State University Libraries and Media Services
http://www.personal.kent.edu/~mkreyche
330-672-1918
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.