use strict;
use warnings;
use Data::Dumper;
my %myhash = ();
get_data(\%myhash); #pass hash ref
$myhash{k2} = "Hello SO"; #add one more key value
print Dumper($hash_ref); #Dump hash ref
sub get_data{
my $hash_ref = shift; #get hash ref
$hash_ref->{k1} = "adding one more key value"; #fill data
}
вывод:
$VAR1 = {
'k2' => 'Hello SO',
'k1' => 'adding one more key calue'
};