CREATE EXTENSION plperl;
CREATE EXTENSION hstore;
CREATE EXTENSION hstore_plperl;

CREATE FUNCTION tied_hstore() RETURNS hstore
LANGUAGE plperl TRANSFORM FOR TYPE hstore AS $$
  use Tie::Hash;
  my %h;
  tie %h, 'Tie::StdHash';
  $h{a} = '1';
  $h{b} = '2';
  return \%h;
$$;

SELECT tied_hstore();
