my %returnValues=%$rVals; does not setup an alias, as you seem to assume, but copies the $rVals hash. If you change the copy afterward with $returnValue{"ExcelLink"}=... the original doesn't follow. Either copy back with %$rVals=%returnValues; or change the original instead with $rVals->{"ExcelLink"}=...