Hi
Perl_Ally,
the code you posted is unsufficient for us to help you. You have two subs, none of which calls the other and there is no "main" code to call either of the subs. And the subs are not working on the same data. There is no way we can test, or understand, or fix, the code you presented. Please give more of the context.
Please p^rovide a full program (even faulty).