in reply to Dynamic Memory allocation
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
|
---|