in reply to Dynamic Memory allocation

If the my @l_UserDetails is declared at main scope, the array inside the hash is indeed the same array.

To give it a life of its own instead, a copy of the array first has to be declared with dynamic scope:

my %g_User; my @l_UserDetails = ('hallo','goodbye'); InsertArray( \@l_UserDetails, \%g_User, 'user1' ); sub InsertArray { my $aref = shift; my $href = shift; my $elt = shift; my @dynamic = @$aref; $href -> { $elt } = \@dynamic; }

-M

Free your mind