+1 "count" can possibly be complemented or replaced with occurrence as suggested. It'd be nice to be able to denote last occurrence [-1]. And I suppose the indexing should be based on ordinary perl subscript indexing - i.e. governed by the value of special variable $[
$field->delete_subfield( code => $code, # of course occur => [0,2,3], # "occur" or "pos" or whatever... match => qr/pat/, # doesn't need to be repeatable ); Leif ====================================== Leif Andersson, Systems Librarian Stockholm University Library SE-106 91 Stockholm SWEDEN Phone : +46 8 162769 Mobile: +46 70 6904281 -----Ursprungligt meddelande----- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Brad Baxter Skickat: den 1 maj 2006 22:21 Till: Bryan Baldus Kopia: perl4lib Ämne: Re: Deleting a subfield using MARC::Record 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