If I'm not wrong, sprintf syntax is sprintf FORMAT, LIST See http://perldoc.perl.org/functions/sprintf.html for instance. So the statement my $new_marc = $bib_rec->as_usmarc(); seems the good way to accomplish your need. Bye. Stefano
On Mar 12, 2012, at 14:49 , Anne Highsmith wrote: > I am running a perl program that uses an API to update MARC records in an > ILS. Voyager & BatchCat, for you Voyager folks. I have to pass a bunch of > parameters to the API, of course, including the updated marc record as a > string. The input record is UTF8, so the output must be also. Previously, > I've used this statement to turn the MARC record object back into a string: > > my $new_marc = sprintf($bib_rec->as_usmarc()); > > I'm running into lots of problems with the latest batch of records I'm > editing, however, because the data has lots of embedded percent signs (%), > which perl is not interpreting as part of the data but as part of a perl > command; it fails with some kind of error in sprintf. > > I tried using this statement instead of the above: my $new_marc = > $bib_rec->as_usmarc(); > > i.e. leaving sprintf out of it entirely. It seems to work WITHOUT the errors > induced by the percent signs. > > Can anybody think of any reason why I shouldn't just use " my $new_marc = > $bib_rec->as_usmarc();". And if you can, can you suggest an alternative way > to correctly turn the object into a string? > > >