Re: Deleting a subfield using MARC::Record
[email protected] ("Brad Baxter")
| Newsgroups | perl.perl4lib |
|---|---|
| Message-ID | <[email protected]> |
On 5/1/06, Bryan Baldus <[email protected]> wrote: > On Monday, May 01, 2006 1:24 PM, Brad Baxter wrote: > >On 4/30/06, Edward Summers <[email protected]> wrote: > >[snip] > >> # delete first two subfield u > >> $field->delete_subfield(code => 'u', count => 2); > > > >I don't think I like it this way. How would you delete just > >the second one? > >I'd rather see 'count' mean 'occurrence', so the above would mean > >delete the second subfield u. And ... > > > ># delete second and third subfield u > >$field->delete_subfield(code => 'u', count => 2, count => 3); > > > > When I looked at it, I also wondered about 'count' being 'position' or > something like that, to be able to note which occurrence. It might be useful > to have both--if you know it is always the 1st 2 occurrences of the > subfields, use 'count', but if you know it is the 1st and 3rd, then use > 'position' or 'occurrence'. > > examples: > #remove 1st 2 subfield 'u' > $field->delete_subfield(code => 'u', count => 2); > > #remove 1st and 3rd subfield 'u' > $field->delete_subfield(code => 'u', occurence => (0, 2)); #or (1, 3) > > #remove last subfield u > $field->delete_subfield(code => 'u', occurence => (-1)); > I guess those work for me, as long as it's 'occurrence'. :-) Or perhaps just 'occur'. (If we allow -1, then I agree it should start at 0.) -- Brad