You give us no specific clue as to what sort of "Excel file" you are dealing with, but have you carefully trolled through the CPAN libraries to see if there is anything there which would offer you a much more robust, "tested and proved by other people," approach to your problem? Perhaps you have jumped right in with the assumption that this is a problem that you must custom-solve for yourself when in fact it has already been dealt with much better by software that's yours to install.