Soumyadeep nandi wrote:

>Hi Everybdy,
>I am stuck in a problem for which I need your help. My
>problem spins around adding an element in an array
>within a hash. 
>I have a hash declared as $hash{"1"[EMAIL PROTECTED]; now I
>want to add an element to it within a loop. How would
>I do this? I would be highly grateful to you if you
>could help me.

Your syntax puts a number (the number of elements in @array into $hash{"1"}.

I guess you want to set an array reference as the hash key's value:

$hash{"1"} = [EMAIL PROTECTED];

In that case, you can just

push @{$hash{"1"}}, $_ for (...list goes here...);

to push into the array referenced by $hash{"1"}.

Best,

Jan
-- 
These are my principles and if you don't like them... well, I have others. - Groucho 
Marx

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to