in reply to Hash not getting updated

Hi, try this here is the problem and solution,

The problem is your key and value is assigned to hash. Each time they assigned. so, in that final value only stored in hash and the key printed for that hash is yellow. ie. That is the problem.

So, don't assigned to hash each time, please use like below mentioned code.

my @array = ("white","blue","yellow"); my %hash = (); foreach my $temp (@array) { $hash{$temp}=$temp; } print keys %hash;

Regards
Gube.