Well, judging from the subroutine name (sub handler) and the variable $r, I'm betting it's code running under mod_perl and $r is the HTTP request object.
What's the OP fails to state is how he expects his hash to print. One way or other he needs to serialise it (transform it into a string suitable for outputting). Perhaps Data::Dumper? Storable? But I can't imagine shoving a Perl-style hash to a client to be of much use. Perhaps he wants the hash in one of the markup formats such as XML or YAML or JSON instead?