CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [FishMonger] /g not working?: Edit Log



alberto_zurita
New User

Sep 9, 2014, 9:03 AM


Views: 3362
Re: [FishMonger] /g not working?

Thanks guys:

It looks like it might be a different problem, because even before replacing the string, the value of $data_h is just one [e r]pattern.
I followed your advise FishMonger, and printed this value by itself:


Code
if($record->field('245')->subfield('h') =~ /\[electronic resource\]/g){ 
print( "this record contains [electronic resource]: ", $record->field('245')->subfield('h'),"\n");
my $data_h = $record->field('245')->subfield('h');

#$data_h =~ s/\[electronic resource\]\s*//g;
#$data_h =~ s/\[electronic resource\]//g;
print( "data_h is: ", $data_h,"\n");

}


Output:

perl memoirs.pl memo_recs.mrc
this record contains [electronic resource]: [electronic resource] [electronic resource] [electronic resource] [electronic resource]
data_h is: [electronic resource].

It looks this variable is only being assigned the first or last $h value.

This might mean $record->field('245')->update(h => $data_h) is only updating the first occurrence of [electronic resource] with a blank.

I got a little confused! Smile ?

It looks like it is more of processing the MARC record, than a PERL issue.


(This post was edited by alberto_zurita on Sep 9, 2014, 9:04 AM)


Edit Log:
Post edited by alberto_zurita (New User) on Sep 9, 2014, 9:04 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives