Hi Charlie,
Thanks for the reply.
I've put the code I'm using at the end along with some of the input file, the error messages, and the output. It's a simple script to convert my bibliography.bib to one with journal names in a standard format.
And when I say it get's all screwed up I mean that when there's a % I get the message
>Invalid conversion in printf: "%M" at ./convert.bib.using.jtitle.pl line 216, <BIBIN> line 1.
and such when ever there's a line with a %
when there's an& I get...
Invalid conversion in printf: "%e" at ./convert.bib.using.jtitle.pl line 216, <BIBIN> line 4806.
and it adds a \ before &
I suspect there's an easy solution if I had more of a clue...
Mike
__________________________________________________ _____________
#define bibliography file with full journal names
my $bibfull = "bibliography.bib";
#define output file for abbreviated names
my $bibabbr = "bibliography.full.bib";
#load $bibfull and $bibabbr
open BIBIN, $bibfull or die "Couldn't open $bibfull file. Exiting...\n";
open BIBOUT, " >$bibabbr";
my $linestart;
my $fulltitle;
my $abbrtitle;
my $temp;
#read through BIBIN file
while (<BIBIN>) { #each line read into $_ variable
#THIS IS SORTA IRRELAVENT TO THE PROBLEM
#test to see if its a title
if (/^\s*journal\s*=\s*(\w*),/) {
$linestart = ' journal = {';
$abbrtitle = $1;
#convert to all lower case
$abbrtitle=~s/(\w+)/\L$1/g;
if($fulltitle = $lctitle_hash{$abbrtitle}){
$linestart .= $fulltitle;
}
else{
#no abbreviation found
print "\nno abbrv. found for $abbrtitle\n";
$abbrtitle=~s/\b(\w)/\U$1/;
$fulltitle= $abbrtitle;
print "Using $fulltitle\n\n";
}
$linestart .= "\},\n";
printf BIBOUT $linestart;
}
#HERE IS WHERE I GET THE PROBLEM
else{
printf BIBOUT $_;
}
}
close BIBIN;
close BIBOUT;
__________________________________________________ ____________________
Debugging output:
DB<1> c
Invalid conversion in printf: "%M" at ./convert.bib.using.jtitle.pl line 216, <BIBIN> line 1.
Use of uninitialized value in printf at ./convert.bib.using.jtitle.pl line 216, <BIBIN> line 408.
Use of uninitialized value in printf at ./convert.bib.using.jtitle.pl line 216, <BIBIN> line 1643.
.
.
.
__________________________________________________ ___________________
Lines in file that are associated with debugging output
1: %Master Bibiligraphy
408: this behavior can be as high as 10-20\% but declines
1643: optical density ratio (%OD), and amino black
strangely, there's a % in line 1641, but it doesn't seem to cause an error...
the line is
1641: volume ratio (%vol) using Melanie II is a better
__________________________________________________ __
Output associated with above errors
1:%Master Bibiligraphy
408: this behavior can be as high as 10-20\0ut declines
1643: optical density ratio (0D), and amino black
and for
1641: volume ratio (l) using Melanie II is a better