note
graff
Apart from the problem cited in the first reply, you could accomplish the same goal with a lot fewer lines of code -- e.g. this:
<c>
if ( $abbr =~ s/([123][sdp])// ) {
push(@abbr, $1);
$abbr =~ s/\s//g;
};
</c>
will replace 45 lines of OP code (the 5-line block that is repeated 9 times, for each combination of 1/2/3 with s/d/p).
<P>
A similar refactoring should be done on all those blocks that "do the nasty" with @inlist -- you should be able to reduce all of those blocks down to a single loop as well, and then you only have to fix the misuse of "push" on the one remaining instance of that problem.
<P>
(updated to fix wording in 1st paragraph)
<P>
Oh, and instead of this:
<c>
if ( $file[$i] =~ m/(\\gll|\\ag\.|\\bg\.|\\cg\.|\\dg\.|\\eg\.|\\fg\.|\\exg\.|\\exg)/ )
</c>
How about:
<c>
if ( $file[$i] =~ /(\\(?:gll|[abcdef]g\.|exg\.?))/ )
</c>
(updated last snippet to include a much-needed ":" after the first "?")
777633
777633