in reply to bug or curly bracket hell?

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[1]); 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.

Replies are listed 'Best First'.
Re^2: bug or curly bracket hell?
by soonix (Canon) on Jan 05, 2023 at 20:03 UTC
    Seconding this. Especially the perltidy hint. $rowCount1++ seems to be offdented.
    Note perltidy is a command line tool. If it isn't installed yet, you can install it from the command line with cpan Perl::Tidy

    Also helpful (old but gold) Basic debugging checklist

      Note perltidy is a command line tool

      Also available as an online tool

        Though many people would not be able to justify submitting their source code to an unknown third party.

        Update: fixed typo

Re^2: bug or curly bracket hell?
by MoodyDreams999 (Beadle) on Jan 06, 2023 at 21:46 UTC
    Thank you, I will work on trimming it up and trying to reduce the amount of lines I have. I ran it through PerlTidy now its spiting out a bunch of use of uninitialized value $Z so at least now I have some more direction with it and a better idea of how to submit my code for help.

      The most important first step for us is if you could provide code that compiles, which means that it does not give an error when you run it through perl -c