<?xml version="1.0" encoding="Windows-1252"?>
<node id="721927" title="Interpretation of my output" created="2008-11-06 04:39:06" updated="2008-11-06 04:39:06">
<type id="115">
perlquestion</type>
<author id="721922">
musa</author>
<data>
<field name="doctext">
I am new to perl and I have the following script.
&lt;code&gt;
$tree = &lt;&gt;; chop($tree); 
while ($tree=~s/\(?([A-Z])([A-Z])\)?/\1/) {
    print $tree;
    print "\n";
}
&lt;/code&gt;
When I run this program with input (A((BC)D)(EF)), i get the following output, which I don't understand. Can some explain this regular expression
&lt;code&gt;
(A(BD)(EF))
(AB(EF))
A(EF))
AE)
A
&lt;/code&gt;



</field>
</data>
</node>
