sub get_hash { my %h; ... ;return \%h} my (*h2)= get_hash(); #I'm not sure about the best syntax print keys %h2;