How do I resolve Postgresql error, "PL/Perl function must return reference to hash or array"?
Short answer, coerce what you return to a string, should work fine in 8.4 and 9.1:

return URI-&gt;new('http://www.google.com/')-&gt;canonical().'';


See http://archives.postgresql.org/pgsql-bugs/2012-05/msg00096.php for my full response.