Unfortunately, the code you've posted here does not compile. As far as I can tell, you've got an elsif followed by an else, followed by another elsif. Perhaps you have a closing curly and else missing on the outer if, but it's really hard for me to tell where because the code you've posted is also 256 lines long.
In order to get the most efficient help possible, please first fix your code so that it at least compiles. Also, you should always Use strict and warnings, since that will help you avoid other mistakes. And I recommend you use perltidy to format your code so that the indentation is better, this will also help you spot issues like missing braces much faster. If you follow all of this advice, we will very likely be able to help you quite quickly. In addition, providing some short but representative sample input with the expected output for that input would be very helpful. "Representative" in this case means especially that each branch of your multiple if-elsif-elses should be exercised by the sample input. See also SSCCE.
Another thing that will shorten your code significantly is if you take the many, many lines that look like $worksheet2->write($rowCount2+1, 1, $t); and turn them into a loop, such as $worksheet2->write($rowCount2+1, $_, $t[$_]) for 1..11;. I see that in each case you're replacing a different element with something from @ary, which is something you could probably also do by assigning to the appropriate element of @t before that loop - due to the length of the code it's a little difficult for me to tell if that works with all of your logic, but in the worst case you could always just make a temporary copy of @t and modify that.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.