<?xml version="1.0" encoding="windows-1252"?>
<node id="777694" title="Re: LaTeX Abbreviations for Linguists" created="2009-07-06 18:07:32" updated="2009-07-06 18:07:32">
<type id="11">
note</type>
<author id="44715">
graff</author>
<data>
<field name="doctext">
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:
&lt;c&gt;
         if ( $abbr =~ s/([123][sdp])// ) {
            push(@abbr, $1);
            $abbr =~ s/\s//g;
         };
&lt;/c&gt;
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).
&lt;P&gt;
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.
&lt;P&gt;
(updated to fix wording in 1st paragraph)
&lt;P&gt;
Oh, and instead of this:
&lt;c&gt;
if ( $file[$i] =~ m/(\\gll|\\ag\.|\\bg\.|\\cg\.|\\dg\.|\\eg\.|\\fg\.|\\exg\.|\\exg)/ )
&lt;/c&gt;
How about:
&lt;c&gt;
if ( $file[$i] =~ /(\\(?:gll|[abcdef]g\.|exg\.?))/ )
&lt;/c&gt;
(updated last snippet to include a much-needed ":" after the first "?")</field>
<field name="root_node">
777633</field>
<field name="parent_node">
777633</field>
</data>
</node>
