Thanks!

The script returns an error msg:

Global symbol "$f500" requires explicit package name at s.pl line ###
Execution of s.pl aborted due to compilation errors.

The $f500 was deleted in the earlier loop.  Was that the cause?

BTW, was there a difference between the close curly bracket with
or without semicolon (  } and }; ) ?

--Jackie

On Tue, 3 Aug 2004, Timothy Prettyman wrote:

> In your foreach loop, you write a new 534 for every 500 that you find.  The
> first one has the subfield a from it, the 2nd one has a subfield a from the
> first and second, etc.  What you really want to do is something like:
>
> if (@f500s) {
>   my @subfields = ();
>   foreach my $f500 (@f500s) {
>     $f500->subfield('a')) and do {
>       push (@subfields, 'n', $f500->subfield('a'));
>       $record->delete_field($f500);
>     };
>   }
>   (@subfields) and do {
>     my $new534 = MARC::Field->new('534', '', '', @subfields);
>     $record->insert_fields_after($f500, $new534);
>   };
> }
>
> Tim Prettyman
> University of Michigan Library
>
> --On Tuesday, August 3, 2004 10:24 AM -0400 Jackie Shieh <[EMAIL PROTECTED]>
> wrote:
>
> >
> > I am deconstructing multiple 500 note fields and putting
> > the data in subfield n of 534 (Notes to original version).
> >
> > When there are more than one 500 notes, this script creates
> > two 534 fields, one with the first previously 500 note field
> > in subfield n, and the other 534 field with two 500 note
> > fields.  Instead of one single 534 with as many subfield
> > n's corresponding to the original 500 note fields.  Can
> > someone help decipher this for me?  Where did it go wrong?!
> >
> >## if present, put data in variable to use in 534$n
> >
> >     if ( @f500s ) {
> >         my @subfields = ();
> >
> >     ## examine each one
> >        foreach my $f500 (@f500s) {
> >                  my $n534=$f500->subfield('a');
> >                  push(@subfields, 'n', $n534);
> >
> >     ##begin to put 500 a to 534 n
> >
> >                 my $new534 = MARC::Field->new( '534','','', @subfields);
> >                 $record->insert_fields_after($f500, $new534);
> >                 $record->delete_field($f500);
> >             }
> >
> >      }
> >
> ># if 500 is not repsent, create a brand new 534
> >
> >      else {
> >            my $new534 = MARC::Field->new( '534', '','', 'p', 'Transcribed
> > from: ');
> >            $record->insert_fields_after($f260, $new534);
> >
> >      }
> >
> >
> > ================================================================
> > Input file contains:
> >
> > 500    _a"London : Spottiswoodes and Shaw"--T.p. verso.
> > 500    _a"Notes" (p. [31]-39) contain extracts from Sir J. Malcolm's
> > "Central India" regarding Ahalya Baee.
> >
> >
> > Output file results:
> >
> > 534    _n"London : Spottiswoodes and Shaw"--T.p. verso.
> > 534    _n"London : Spottiswoodes and Shaw"--T.p. verso.
> >        _n"Notes" (p. [31]-39) contain extracts from Sir J. Malcolm's
> > "Central India" regarding Ahalya Baee.
> > =====================================================================
> >
> > Thanks for any help!!
> >
> > Best,
> >
> > --Jackie
> >
> >| Jackie Shieh
> >| Special Projects & Collections Team
> >| Harlan Hatcher Graduate Library
> >| University of Michigan
> >| 920 North University
> >| Ann Arbor, MI      48109-1205
> >| Phone: 734.936.2401   FAX: 734.615.9788
> >| E-mail: [EMAIL PROTECTED]
> >

Reply via email to