good chemistry is complicated,
and a little bit messy -LW
Personally, the decision as to whether to return a hash or a hash reference would be made on the basis of the size of the hash, and the frequency with which the subroutine is called. If the hash is small and the subroutine is only called a few times, I might return the whole thing simply because it makes the notation for using the hash much simpler in the calling code.
Of course, that can be overcome by passing a reference to a hash declared in the calling code to the sub and having it populate it. The return then becomes (almost)irrelevant, serving only as a marker that the hash may have been modified. Though you might opt to return undef if the sub was unable to complete its task, and the passed hashref if successful.
It's worth pointing out that your example sub could be replaced by my %INPUT = $CGI->Vars; or $INPUT = $CGI-Vars;.
See section "FETCHING THE PARAMETER LIST AS A HASH:" in the CGI.pm pod for more info.
Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
In reply to Re: Subroutines: Returning a hash vs. hash reference