in reply to Odd crash involving Spreadsheet::WriteExcel
My guess is that $range does not contain what you think it does and/or that intToRange returns a list where you expect it to return a scalar?
I assume that intToRange is something like Spreadsheet::WriteExcel::Utility::xl_range_formula, but the current documentation for Spreadsheet::WriteExcel documents ->merge_range as
->merge_range($first_row, $first_col, $last_row, $last_col, $token, $f
... so the call to intToRange seems completely unnecessary.