On Tuesday, January 11, 2005 2:13 PM, Michael Doran wrote:
>Assuming that you asking how to strip out the MARC-8 combining diacritic
characters, try inserting the substitution >commands listed (as shown below)
just prior to the substr commands:
>> my $ME = $field->subfield('a');
> $ME =~ s/[\xE1-\xFE]//g;
>> my $four100 = substr( $ME, 0, 4 );
>
>> my $TITLE = $field->subfield('a');
> $TITLE =~ s/[\xE1-\xFE]//g;
>> my $four245 = substr( $TITLE, 0, 4 );
You might want to change the procedure for getting the title to skip
articles (untested, may need corrections):
#given $record being the MARC::Record object, and exactly 1 245 field being
present, as required by MARC21 rules
my $titleind2 = $record->$field('245')->indicator(2);
my $TITLE = $field->subfield('a');
$TITLE =~ s/[\xE1-\xFE]//g;
my $four245 = substr( $TITLE, 0+$titleind2, 4 ) if $titleind2 =~/^[0-9]$/;
#the if statement should be unnecessary, since 245 2nd indicator should
always be some number, but just in case.
Hope this helps,
Bryan Baldus
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://home.inwave.com/eija