jacques,
In the first working example, a hash is passed to the sub by reference and so modifications to the underlying data structure are reflected after the sub exits. In the second broken example, the sub is creating a lexical hash reference that can't possibly affect a hash outside of its scope. The solution is to modify the module's sub to accept a hash reference.