assign the reference of the hash.
--- Simon Tomlinson <[EMAIL PROTECTED]> wrote: >
Hi
>
> I want to put a hash into each element of an array.
> I do it like the following bit of code. When I
> iterate round my hash before putting it in the array
> of the hash values/keys are there. However, when I
> iterate through the hash after putting it in the
> array all i get is '4/8' as the ouput.
>
> I am sure this is very simple and I'm doing
> something stupid. Does anyone have any ideas?
>
> Thanks in advance,
> Simon.
>
> my @array
> my $count = 0;
> my $maxCount = 4;
>
> while $count < $maxCount
> {
> my %myHash = &getHash;
>
> foreach $key (keys %myHash )
> {
> print "THIS WORKS: $key $myHash{$key}\n";
> }
>
> # Now assign the hash to my array
> $array[$count] = %myHash;
>
> my %newHash = $array[$count];
> foreach $key (keys %newHash )
> {
> print "THIS DOESN'T WORK: $key $newHash
> {$key}\n";
> }
> }
>
>
> --
>
> This e-mail may contain confidential and/or
> privileged information. If you are not the intended
> recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy
> this e-mail. Any unauthorized copying, disclosure or
> distribution of the material in this e-mail is
> strictly forbidden.
>
>
>
> --
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]