Using References

sub person_details {
  my %details = (
    surname   => 'Wallaphocter',
    firstname => 'Ignatius',
  );
  return \%details;
}

my $ref = person_details();
print $ref->{surname};
sub person_details {
  return {
    surname   => 'Wallaphocter',
    firstname => 'Ignatius',
  };
}

print person_details()->{surname};