sub createContract { $key = "123456789"; # If you want to share a newly created reference unfortunately # you need to use "&share([])" and "&share({})" syntax due to # problems with Perl's prototyping. # man page $Contracts{$key} = &share([]); $Contracts{$key}[0] = 100; $Contracts{$key}[1] = 200; $Contracts{$key}[2] = 300; $Contracts{$key}[3] = 400; printf " %s %u^%u^%u^%u^\n", $key, $Contracts{$key}->[0], $Contracts{$key}->[1], $Contracts{$key}->[2], $Contracts{$key}->[3], ; } # Generates ... 123456789 100^200^300^400^ 123456789 100^200^300^400^