#!perl use strict; use warnings; use threads; use threads::shared; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new('test.xls'); my $worksheet = $workbook->add_worksheet('sample'); #---this works processfile($worksheet); #--this will corrupt excel file , irrespective of worksheet being shared or private. #threads->new(\&processfile,$worksheet)->join(); $workbook->close(); sub processfile { my($wrksheet)=@_; $wrksheet->write(0, 0, "Hi Excel!"); return ; }