in reply to Interpretation of my output

Where did the script come from? Wherever you found it I would avoid. There are a few problems with it that indicate that it is old or written by someone who doesn't know Perl very well.

For a start you should generally use chomp instead of chop.

([A-Z])([A-Z]) is better written ([A-Z]{2}).

The print should be a single line using string interpolation: print "$tree\n";

The substitution should use $1 instead of \1.

You should always use strictures (use strict; use warnings;).

Update: too enthusiastic finding improvements


Perl reduces RSI - it saves typing

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.