in reply to class object and hash

use strict; use warnings; my %hash1 = %{create()}; my $ref = create(); my %hash2; give(\%hash2); print $hash1{'a'} . $ref->{'b'} . $hash2{'c'}; sub create { my %hash = ('a' => '1', 'b' => '2'); return \%hash; } sub give { my $ref = shift; %$ref = ('c' => '3', 'd' => '4'); }
Here's three ways to pass hash data from a sub.