in reply to Dynamic Memory allocation

How did you check that the array gets destroyed when the control leaves your function?

use strict; my %g_User; sub setup_user_details { my ($username) = @_; my @l_UserDetails = ("John","Doe"); $g_user{$username} = \@l_UserDetails; }; setup_user_details('user1');

Your naming convention is a bit unwieldly, but I attribute that to your company coding guidelines. In Perl it's conventional to use lower_caps_names instead of CamelCase, and prefixing of variables with their scope is uncommon because the strict pragma enforces proper scoping.