I think you should change the order of operations:
This way you would avoid creating the Excel file if the content recovered is not correct (think getting a 404 from LWP).
I would also consider two things:
In reply to Re: How to write to a excel file while downloading in cgi perl
by glasswalk3r
in thread How to write to a excel file while downloading in cgi perl
by ghosh123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |