|Pathologically Eclectic Rubbish Lister|
Best way to take reference to an array \ or by vinoth.ree (Vicar)
|on Jan 22, 2013 at 11:30 UTC||Need Help??|
vinoth.ree has asked for the
wisdom of the Perl Monks concerning the following question:
In the above code am trying to get the user details into the %user_details hash, the keys will be the user name and value will be in the array, For Ex.
I thought to save the array as array reference, for each users, So I tried to take the array reference with \ (backslash), this is the normal method I use to take reference to a array. Ex:
But this method does not worked for me.
I tried the another method to take reference to an array as , it works fine for me, Now its confusing me.
Which method I need to use always to take reference to an array ?Notice:
When I use my inside that while loop like while (my @temp = getpwent())) that \ method of taking reference works fine.Update:
updated the code, changed $arr_ref to $hash_ref, as point out by muba