in reply to Re^2: Spreadsheet::ParseExcel assigning the column
in thread Spreadsheet::ParseExcel assigning the column

This

my @value; ##to get the headers of the excel file; for my $row ( 0 .. 0 ) { @value = map { my $cell = $worksheet->get_cell($row, $_); $cell ? $cell->value() : ''; } @required_col; }

can be simplified to just

##to get the headers of the excel file; my @value = map { my $cell = $worksheet->get_cell(0, $_); $cell ? $cell->value() : ''; } @required_col;

And since you're modifying the arrays passed to your subroutine, it looks like you just need to dereference them so that you make a copy.

sub changeformat { my ($header,$data) = @_; my @header = @$header; my @data = @$data;

Then only perform your operations on the new @header and @data arrays and not on $header or $data.